VB如何建立多人通信
Public Function FindFreeSock(SockName As Winsock)Dim i
For i = 0 To SockName.Ubuod
If i = SockName.Uboud Then
Load (i + 1)
End If
If SockName(i).State = 0 Then
SockName(i).Listen
End If
Next
End Function
---------------------------------------------------------
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入IP地址!"
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "请输入监听端口!"
Exit Sub
End If
FindFreeSock (Socket)---------------------------------此行出错
With Socket
.RemoteHost = Text1.Text
.RemotePort = Text2.Text
End With
Socket
With Sock
.RemoteHost = Text1.Text
.RemotePort = Text2.Text
End With
Sock.Connect
Picture1.Print "正在连接......"
End Sub