谁能帮我一下忙那里出错了 谢谢
Private Sub Command2_Click()Winsock2.SendData Text2.Text
End Sub
Private Sub Timerl_Timer()
Labell.Caption = GetState(Winsock1.State)
Label2.Caption = GetState(Winsock2.State)
End Sub
Private Function GetState(tmp As Long) As String
Select Case tmp
Case 0
GetState = "默认的。关闭"
Case 1
GetState = "打开"
Case 2
GetState = "侦听"
Case 3
GetState = "连接挂起"
Case 4
GetState = "识别主机"
Case 5
GetState = "已识别主机"
Case 6
GetState = "正在连接"
Case 7
GetState = "已连接"
Case 8
GetState = "同级人员正在关闭连接"
Case 9
GetState = "错误"
End Select
End Function
Private Sub Form_Long()
Winsock1.LocalPort = 65500
Winsock1.Listen
'开启侦听
Winsock2.RemoteHost = "127.0.0.1"
'表示服务器主机名
Winsock2.RemotePort = 65500
'表示服务器端口
Winsock2.Connect
'连接到服务器
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close ← 这里怎么该啊
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
Winsock2.Close
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock2_Close()
Winsock2.Close
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Dim s As String
Winsock2.GetData s
Text2.Text = s
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim s As String
Winsock1.GetData s
Text1.Text = s
End Sub
Private Sub Command1_Click()
Winsock1.SendData Text1.Text
End Sub
大哥大姐 帮帮忙
[ 本帖最后由 zdc582047 于 2010-12-17 14:56 编辑 ]