VB 不管怎么修改都提示40006错误,什么原因
服务端:PrivateSubCommand1_Click()Me.Winsock1.SendDataTrim(Text2.Text)EndSubPrivateSubCom...
服务端:
Private Sub Command1_Click()
Me.Winsock1.SendData Trim(Text2.Text)
End Sub
Private Sub Command2_Click()
Text2.Text = ""
End Sub
Private Sub Command3_Click()
Winsock1.Close
End Sub
Private Sub Form_Load()
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
Me.Text1.Text = "与控制端连接成功"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text1.Text = Me.Text1.Text & mys & vbCrLf
End Sub
客户端:
Private Sub Command1_Click()
Winsock1.RemoteHost = Trim(Me.Text1.Text) '远程计算机的名称或地址
Winsock1.RemotePort = Trim(Me.Text2.Text)
Winsock1.Close
Winsock1.Connect
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Winsock1.SendData Trim(Text4.Text)
End Sub
Private Sub Command3_Click()
Text4.Text = ""
End Sub
Private Sub Command4_Click()
Me.Winsock1.Close
Me.Command1.Enabled = True
End Sub
Private Sub Form_Load()
Command4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Me.Text3.Text = "与被控端连接成功!" & vbCrLf
Winsock1.SendData Winsock1.LocalIP '返回本地机器的 IP 地址
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text3.Text = Me.Text3.Text & mys & vbCrLf
End Sub 展开
Private Sub Command1_Click()
Me.Winsock1.SendData Trim(Text2.Text)
End Sub
Private Sub Command2_Click()
Text2.Text = ""
End Sub
Private Sub Command3_Click()
Winsock1.Close
End Sub
Private Sub Form_Load()
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
Me.Text1.Text = "与控制端连接成功"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text1.Text = Me.Text1.Text & mys & vbCrLf
End Sub
客户端:
Private Sub Command1_Click()
Winsock1.RemoteHost = Trim(Me.Text1.Text) '远程计算机的名称或地址
Winsock1.RemotePort = Trim(Me.Text2.Text)
Winsock1.Close
Winsock1.Connect
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Winsock1.SendData Trim(Text4.Text)
End Sub
Private Sub Command3_Click()
Text4.Text = ""
End Sub
Private Sub Command4_Click()
Me.Winsock1.Close
Me.Command1.Enabled = True
End Sub
Private Sub Form_Load()
Command4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Me.Text3.Text = "与被控端连接成功!" & vbCrLf
Winsock1.SendData Winsock1.LocalIP '返回本地机器的 IP 地址
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text3.Text = Me.Text3.Text & mys & vbCrLf
End Sub 展开
3个回答
展开全部
服务端代码改成如下
Private Sub Command1_Click()
Me.Winsock1.SendData Trim(Text2.Text)
End Sub
Private Sub Command2_Click()
Text2.Text = ""
End Sub
Private Sub Command3_Click()
Winsock1.Close
End Sub
Private Sub Form_Load()
Winsock1.Bind 30000
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
Me.Text1.Text = "与控制端连接成功"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text1.Text = Me.Text1.Text & mys & vbCrLf
End Sub
客户端代码改成下面的
Private Sub Command1_Click()
Winsock1.RemoteHost = Trim(Me.Text1.Text) '远程计算机的名称或地址
Winsock1.RemotePort = Trim(Me.Text2.Text)
Winsock1.Close
Winsock1.Connect
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Winsock1.SendData Trim(Text4.Text)
End Sub
Private Sub Command3_Click()
Text4.Text = ""
End Sub
Private Sub Command4_Click()
Me.Winsock1.Close
Me.Command1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = "127.0.0.1"
Text2.Text = "30000"
Command4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Me.Text3.Text = "与被控端连接成功!" & vbCrLf
Winsock1.SendData Winsock1.LocalIP '返回本地机器的 IP 地址
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text3.Text = Me.Text3.Text & mys & vbCrLf
End Sub
试下吧
Private Sub Command1_Click()
Me.Winsock1.SendData Trim(Text2.Text)
End Sub
Private Sub Command2_Click()
Text2.Text = ""
End Sub
Private Sub Command3_Click()
Winsock1.Close
End Sub
Private Sub Form_Load()
Winsock1.Bind 30000
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
Me.Text1.Text = "与控制端连接成功"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text1.Text = Me.Text1.Text & mys & vbCrLf
End Sub
客户端代码改成下面的
Private Sub Command1_Click()
Winsock1.RemoteHost = Trim(Me.Text1.Text) '远程计算机的名称或地址
Winsock1.RemotePort = Trim(Me.Text2.Text)
Winsock1.Close
Winsock1.Connect
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Winsock1.SendData Trim(Text4.Text)
End Sub
Private Sub Command3_Click()
Text4.Text = ""
End Sub
Private Sub Command4_Click()
Me.Winsock1.Close
Me.Command1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = "127.0.0.1"
Text2.Text = "30000"
Command4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Me.Text3.Text = "与被控端连接成功!" & vbCrLf
Winsock1.SendData Winsock1.LocalIP '返回本地机器的 IP 地址
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim mys As String
Winsock1.GetData mys
Me.Text3.Text = Me.Text3.Text & mys & vbCrLf
End Sub
试下吧
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-04-02
展开全部
比较复杂,建议一步一步删减代码检查
追问
肯定是不容易啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你都没截图说错误断点在哪里
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询