-
winsock
Hi i'm trying to make a simple chat application for me and a mate in the office.
my pc name = "Orleans05"
my mates pc name "orleans11"
now i have been trying to use the winsock control useing the UDP method as described in MSDN. I can get it ro work on my machine ( but that is pointless fro a chat app) I wounder if any one can help.
Below is the code.
code on my machine:
Option Explicit
Private Sub Form_Load()
With udpPeerA
.RemoteHost = "Orleans11"
.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
code I placed on my mates machine:
Option Explicit
Private Sub Form_Load()
With udpPeerB
.RemoteHost = "Orleans05"
.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
hope some one can help.
p.s for once one of Karl moores tut's was little help( sorry Karl , I do love your tuts)
-
What errors are you getting?
And are these pc names the same as what is recognised by the network?
-
Hi rjlohan , Thanks
Yes they are the Names used:
the error is Runn Time '40006'
-
and what error description?
martijn
-
Yeah, give me the description if you can, I hate Error Lookup.
The code you have should work. Check the computer names you are using, and perhaps try using their IP to test if that is where the problem lies.
-
40006 is an invalid state or protocol error.
Since your code does not indicate that you are setting the protocols to one or the other, check properties for the winsock controls and change the protocols to UDT if they are set to TCP.