Search the Community
Showing results for tags 'problem with receiving data'.
-
I've a problem with receiving data on my PC by TCP and UDP. I can send data to another computer, but can't receive it. I'm not shure where is the problem (on PC or on "another comupers") This is client code: ;TCP client TCPStartup() $socket = TCPConnect("192.168.0.18", 7777) ;try to connect to server and save number of socket If $socket = -1 Then ;if $socket = -1 then error MsgBox(16, "Error:", "Can't connect to server") EndIf $sendedBytes = TCPSend($socket, "nothing here :)") ;send message to connected socket If $sendedBytes = 0 Then ;if receiving data TCPSend(...) = 0 then error MsgBox(16, "Error", "Can't send message") EndIf TCPCloseSocket($socket) TCPShutdown() and server code: ;TCP server TCPStartup() $mainsocket = TCPListen("192.168.0.18", 7777) ;making main receiving socket While 1 ;receiving loop $acceptedSocket = TCPAccept($mainsocket) ;possible connection to accept If $acceptedSocket <> -1 Then $receivedData = TCPRecv($acceptedSocket, 1024) ;if main socket is connected then receive message MsgBox(64, "Received message!", "Message: " & $receivedData) TCPCloseSocket($acceptedSocket) ;close open connecion EndIf WEnd TCPShutdown() When server is on PC I can't receive any messages from any other computers. When client is on PC I can receive messages on any another computer. I tried to turn off antiviruses and windows firewall but it did't change anything EDIT: Error code from client from TCPConnect is 10060 (connection time out) and from TCPSend: 10038 I've found something about 10060 error code, Microsoft says "Connection timed out. A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond." So it means that the problem is with time of response but it makes no sense couse "another computer" is Virtual Machine with bridge internet connection from PC (pings beetwen PC and VM are lower than 1ms. About 10038 error code microsoft says that this is problem with socket and it actually makes sense.