$ConnectedSocket = TCPAccept($MainSocket)
If $ConnectedSocket <> -1 Then ;<>-1表示有新客户端连接
$szIP_Accepted = SocketToIP($ConnectedSocket) ;socket转成
$all = UBound($OnlineList) + 1
ReDim $OnlineList[$all][2] ;在线列表数组增加
$OnlineList[$all - 1][0] = $ConnectedSocket ;socket
$OnlineList[$all - 1][1] = $szIP_Accepted ;ip
$sRecv = TCPRecv($ConnectedSocket, 2048, 1)
If $sRecv <> '' Then;如果接收的数据包不为空
$edbmid = BinaryToString($sRecv, 4);将客户端发送的信息写到edit框中
$ConnectedSocket = -1
TCPCloseSocket($ConnectedSocket);发送过一次消息后关闭此连接。
Global $edlb = StringSplit($edbmid, "|")
$edbm = IniRead($ini, "Edit", $edlb[1], "NotFound")
If $edlb[4]="" Or $edlb[5]="" Then
$edlb[4]="******"
$edlb[5]="******"
EndIf
If $edbm <> "NotFound" And $edbm <> "NotFoundid" Then
$edbm = StringSplit($edbm, "|")
IniWrite($ini, "Edit", $edlb[1], $edbm[1] & "|" & $OnlineList[$all - 1][1] & "|" & $edbm[3] & "|" & $edbm[4] & "|" & $edlb[2] & "|" & $edlb[3] & "|" & $edlb[4] & "|" & $edlb[5])
GUICtrlCreateListViewItem($OnlineList[$all - 1][0] & "|" & $edlb[1] & "|" & $edbm[1] & "|" & $OnlineList[$all - 1][1] & "|" & $edbm[3] & "|" & $edbm[4] & "|" & $edlb[2] & "|" & $edlb[3] & "|" & $edlb[4] & "|" & $edlb[5], $ListView1)
EndIf
EndIf
EndIf
服务端太长了取一部份,后面都是一样的。服务端应该没问题。 |