tcp 试下吧~~
服务端
#AutoIt3Wrapper_run_debug_mode=Y
TCPStartUp()
$MainSocket = TCPListen(@IPAddress1, 1212, 100);创建一个套接字(socket)监听.
If $MainSocket = -1 Then Exit ; 创建监听不成功就退出
While 1
$ConnectedSocket = TCPAccept($MainSocket)
If $ConnectedSocket <> -1 Then ExitLoop
WEnd
While 1
$sRecv = TCPRecv($ConnectedSocket, 2048, 1);256)
If @error Then ; 客户端已关闭
Exit
Else
If $sRecv <> "" Then ; 接收到客户端发送数据,开始处理
$rmsg =BinaryToString($sRecv, 4)
$sp = StringSplit($rmsg,"|")
If $sp[0] <= 1 Then Return
IniWrite ("config.ini",$sp[1],$sp[2],$sp[3])
MsgBox (0,"Ini文件写入!",@CRLF&$sp[1]&@CRLF&$sp[2]&@CRLF&$sp[3])
EndIf
EndIf
WEnd
客户端
TCPStartUp()
$socket = TCPConnect(@IPAddress1, 1212 )
If $socket = -1 Then Exit
$sMsg = StringToBinary("ok|config|dscr11", 4)
TCPSend($socket,$sMsg)
|