-
Apr 2nd, 2000, 11:55 PM
#1
Hyperactive Member
UDP
This is from MSDN:
Create 2 forms, peerA and peerB, put a winsock control on the form as well as 2 text boxes:
code for peerB:
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
With udpPeerB
.RemoteHost = "Name of Remote Computer"
.RemotePort = 1002
.Bind 1001
End With
End Sub
Private Sub txtSend_Change()
udpPeerB.SendData txtSend.Text
End Sub
Private Sub udpPeerB_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
udpPeerB.GetData strData
txtOutput.Text = strData
End Sub
code for peerA:
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
With udpPeerA
.RemoteHost = "Name of Remote Computer"
.RemotePort = 1001
.Bind 1002
End With
frmPeerB.Show
End Sub
Private Sub txtSend_Change()
udpPeerA.SendData txtSend.Text
End Sub
Private Sub udpPeerA_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
udpPeerA.GetData strData
txtOutput.Text = strData
End Sub
For testing purposes, put for the "Name of Remote Computer", the name of your computer on the network, for both forms.
Also, please don't feel obligated to put my name in the about box....I didn't exactly invent the wheel, if you know what I mean.
Hope this helps you!
[Edited by compuGEEK on 04-03-2000 at 12:56 PM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules