关于vb中40006错误 10
服务器程序PrivateSubForm_Load()'设置服务器端口2000同时进行绑定防止其应用程序占当前端口winsockserver.Bind2000EndSubP...
服务器程序
Private Sub Form_Load()
'设置服务器端口2000同时进行绑定防止其应用程序占当前端口
winsockserver.Bind 2000
End Sub
Private Sub winsockserver_DataArrival(ByVal bytesTotal As Long)
Dim strRec, strSend As String
winsockserver.GetData strRec, vbString
Select Case strRec 'strRec定要变体
Case "Date", "date", "DATE"
strSend = Date
Case "Time", "time", "TIME"
strSend = Time
Case Else
strSend = "错误请求"
End Select
winsockserver.SendData strSend
lstlog.AddItem Now & "收IP=" & winsockserver.RemoteHostIP & "Port=" & winsockserver.RemotePort & "请求【" & strRec & "】响应【" & strSend & "】"
End Sub
客户端程序:
Private Sub Btnsend_Click()
Dim strtxt As String
WinsockClient.RemoteHost = TxtHost.Text
WinsockClient.RemotePort = TxtPort.Text
strtxt = TxtCommand.Text
WinsockClient.SendData strtxt
End Sub
Private Sub Form_Load()
WinsockClient.Bind 2002
End Sub
Private Sub WinsockClient_DataArrival(ByVal bytesTotal As Long)
Dim strrec As String
WinsockClient.GetData strrec, vbString
TxtResponse.Text = strrec
End Sub
为什么会出现40006错误啊啊 展开
Private Sub Form_Load()
'设置服务器端口2000同时进行绑定防止其应用程序占当前端口
winsockserver.Bind 2000
End Sub
Private Sub winsockserver_DataArrival(ByVal bytesTotal As Long)
Dim strRec, strSend As String
winsockserver.GetData strRec, vbString
Select Case strRec 'strRec定要变体
Case "Date", "date", "DATE"
strSend = Date
Case "Time", "time", "TIME"
strSend = Time
Case Else
strSend = "错误请求"
End Select
winsockserver.SendData strSend
lstlog.AddItem Now & "收IP=" & winsockserver.RemoteHostIP & "Port=" & winsockserver.RemotePort & "请求【" & strRec & "】响应【" & strSend & "】"
End Sub
客户端程序:
Private Sub Btnsend_Click()
Dim strtxt As String
WinsockClient.RemoteHost = TxtHost.Text
WinsockClient.RemotePort = TxtPort.Text
strtxt = TxtCommand.Text
WinsockClient.SendData strtxt
End Sub
Private Sub Form_Load()
WinsockClient.Bind 2002
End Sub
Private Sub WinsockClient_DataArrival(ByVal bytesTotal As Long)
Dim strrec As String
WinsockClient.GetData strrec, vbString
TxtResponse.Text = strrec
End Sub
为什么会出现40006错误啊啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询