Guest User

Untitled

a guest
Jun 8th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.76 KB | None | 0 0
  1. ;client
  2.  
  3. TCPStartup()
  4.  
  5. $socket = TCPConnect("134.0.0.2", 4321)
  6.  
  7. If $socket = -1 Then ;
  8.     MsgBox(16, "Error", "Die Verbindung zum Server konnte nicht hergestellt werden!")
  9. EndIf
  10.  
  11. $sendedBytes = TCPSend($socket, "1")
  12.  
  13. While 1
  14. $a = TCPRecv($socket,1000)
  15. If $a <> -1 And Not($a="") Then MsgBox(0,"",$a)
  16. WEnd
  17.  
  18.  
  19.  
  20.  
  21.  
  22. TCPCloseSocket($socket)
  23. TCPShutdown()  
  24.  
  25.  
  26.  
  27. ;server
  28.  
  29. TCPStartup()
  30.  
  31. ;$mainsocket = TCPListen("134.0.0.2", 4321)
  32. $mainsocket = TCPListen("127.0.0.2", 4321)
  33.  
  34.  
  35. While 1  
  36.     $acceptedSocket = TCPAccept($mainsocket)
  37.     If $acceptedSocket <> -1 Then
  38.         $receivedData = TCPRecv($acceptedSocket, 1024)
  39.         $a = TCPSend($acceptedSocket,"hallo")
  40.             MsgBox(0,"",$a)
  41.         ;TCPCloseSocket($acceptedSocket)
  42.     EndIf
  43. WEnd
Add Comment
Please, Sign In to add comment