vb Winsock1连接问题
PrivateSubCommand1_Click()IfWinsock1.State=sckConnectedThenWinsock1.SendDataText1.Tex...
Private Sub Command1_Click()
If Winsock1.State = sckConnected Then
Winsock1.SendData Text1.Text
Label1.Caption = "yi lian jie "
End If
End Sub
Private Sub Command2_Click()
Winsock1.Connect "20100608-1405", 101
End Sub
Private Sub Form_Load()
Label1.Caption = Winsock1.LocalIP
End Sub
Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
Label1.Caption = "fa song xing xi"
End Sub
——————————————————--
Private Sub Form_Load()
Winsock1.Listen
Label1.Caption = "正在监听...."
End Sub
Private Sub Text2_Change()
If Winsock1.State = sckConnected Then
Winsock1.SendData Text2.Text
Text1.Text = Text2.Text
End If
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim st As String
Winsock1.GetData st
Text1.Text = st
End Sub
————————————————
这个那出错了 怎么不能连接呀
Winsock1能在一个机子上模拟吗 展开
If Winsock1.State = sckConnected Then
Winsock1.SendData Text1.Text
Label1.Caption = "yi lian jie "
End If
End Sub
Private Sub Command2_Click()
Winsock1.Connect "20100608-1405", 101
End Sub
Private Sub Form_Load()
Label1.Caption = Winsock1.LocalIP
End Sub
Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
Label1.Caption = "fa song xing xi"
End Sub
——————————————————--
Private Sub Form_Load()
Winsock1.Listen
Label1.Caption = "正在监听...."
End Sub
Private Sub Text2_Change()
If Winsock1.State = sckConnected Then
Winsock1.SendData Text2.Text
Text1.Text = Text2.Text
End If
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim st As String
Winsock1.GetData st
Text1.Text = st
End Sub
————————————————
这个那出错了 怎么不能连接呀
Winsock1能在一个机子上模拟吗 展开
展开全部
Private Sub Form_Load()
WinsockClient.Close'断开连接,防止之前连接过再次连接的时候出现错误
WinsockClient.RemoteHost = "对方IP地址"
WinsockClient.Connect'连接
End Sub
Private Sub WinsockClient_Connect()
MsgBox "你成功地与聊天服务器进行了连接", vbInformation, "提示"
End Sub
;================================================
Private Sub Form_Load()
Winsockserver.LocalPort = 1225
Winsockserver.Listen
End Sub
Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)
Winsockserver.Close
Winsockserver.Accept requestID
End Sub
WinsockClient.Close'断开连接,防止之前连接过再次连接的时候出现错误
WinsockClient.RemoteHost = "对方IP地址"
WinsockClient.Connect'连接
End Sub
Private Sub WinsockClient_Connect()
MsgBox "你成功地与聊天服务器进行了连接", vbInformation, "提示"
End Sub
;================================================
Private Sub Form_Load()
Winsockserver.LocalPort = 1225
Winsockserver.Listen
End Sub
Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)
Winsockserver.Close
Winsockserver.Accept requestID
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询