两内网的用户可以直接通过IP互相发送消息吗?
RT,这是发送消息的代码,两内网用户可以直接通过IP互相发送和接受消息吗?
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Winsock1.Protocol = sckUDPProtocol '设置为UDP协义
Winsock1.LocalPort = 1001 '设置计算机的端口,随便设置,不过两个要一样
Winsock1.RemotePort = 1001
Winsock1.RemoteHost = "*.*.*.*" '这里应该是设置为别人计算机的IP地址
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) '取得数据时发生
Dim Tmp As String
Winsock1.GetData Tmp, vbString '取得数据
Tmp = "发言内容为**:" + Tmp
Text1.Text = Tmp + Chr$(13) + Chr$(10) + Text1.Text
End Sub
Private Sub Command1_Click() '发送信息
Winsock1.SendData Text2.Text
Text2.Text = ""
End Sub