我现在急需弄懂这个问题,就要在近期做个类似的程序!!!
请高手指点!!!
这是服务器
Option Explicit
Private Sub Command1_Click()
Winsock.SendData Text1.Text
End Sub
Private Sub Form_Load()
Winsock.LocalPort = 1001
Winsock.Listen
End Sub
Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
If Winsock.State <> 0 Then
Winsock.Close
End If
Winsock.Accept requestID
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim i As String
Winsock.GetData i, vbString
Text2.Text = i
End Sub
这是客户端
Private Sub Command1_Click()
Winsock.SendData Text1.Text
End Sub
Private Sub Form_Load()
Winsock.Protocol = sckTCPProtocol
Winsock.RemoteHost = "192.168.0.63"
Winsock.RemotePort = 1001
Winsock.LocalPort = 1000
Winsock.Connect
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim i As String
Winsock.GetData i, vbString
Text2.Text = i
End Sub