Hello
I have been training in TCP connections and with the help of some tutorials i have made a Client and a Server here are the Scripts:
Client:
Server:
I don't know why but the Client does not work i mean this does not work:
And insert this instead (Without comment mark of course), it works (sends the text):
Anyone can help me?
Thanks
I have been training in TCP connections and with the help of some tutorials i have made a Client and a Server here are the Scripts:
Client:
[ autoit ]
Tcpstartup() $Socket = TCPConnect(@IPAddress1, 403) If $Socket = -1 Then MsgBox(0, "Error", 'Could not conncet to the server') EndIf ;$SendBytes = TCPSend($Socket, 'Hello, client has made connection with the server') While 1 $Order = InputBox('Send Order', 'Type your order here:') $SendBytes = TCPSend($Socket, $Order) If $SendBytes = 0 Then MsgBox(0, 'Error', 'The packet was not able to reach the server') EndIf WEnd TCPCloseSocket($Socket) TCPShutdown()
Server:
[ autoit ]
TCPStartup() $MainSocket = TCPListen(@IPAddress1, 403) While 1 $AcceptedSocket = TCPAccept($MainSocket) If $AcceptedSocket <> -1 Then $RecievedData = TCPRecv($AcceptedSocket, 1000000) If $RecievedData <> "" Then MsgBox(0, 'Data Recived', $RecievedData) TCPCloseSocket($AcceptedSocket) EndIf EndIf WEnd
[ autoit ]
However if i delete this:[ autoit ]
[ autoit ]
;$SendBytes = TCPSend($Socket, 'Hello, client has made connection with the server')
Anyone can help me?
Thanks