#include <array.au3>
UDPStartup()
; 注册清理函数.
OnAutoItExitRegister("Cleanup")
; 绑定到一个套接字(SOCKET)
;==============================================
$socket = UDPOpen("59.57.3.66", 27015)
UDPSend($socket, Binary("0xFFFFFFFF54536F7572636520456E67696E65205175657279"))
Global $ServerInfo[10]
$ServerInfo[0] = 0
While $ServerInfo[0] <=3
$data = UDPRecv($socket, 300,1)
$ServerInfo[$ServerInfo[0]+1] = $data
$ServerInfo[0] +=1
WEnd
_ArrayDisplay($ServerInfo)
While 1
$data = UDPRecv($socket, 200,1)
If $data <> "" Then
ConsoleWrite($data & @CRLF )
EndIf
sleep(1)
WEnd
Func Cleanup()
UDPCloseSocket($socket)
UDPShutdown()
EndFunc
|