PDA

Click to See Complete Forum and Search --> : Winsock UDP


switch78
Apr 21st, 2001, 10:58 AM
Hello,

I've been working on a Log server for a game and built it to work with TCP. I have nearly completed the parsing for all the logs so I figured it was time to get started on the communication between the apps. That's when I learn that the Game server uses UDP.

I figured it would be a piece of cake to change my code over to UDP, but I apparently was wrong. So I built to VERY basic apps to communicate with UDP for practice... I don't understand something I guess.

Server Code:

Private Sub form_Load()
wskMain.localport = 2006
End Sub

Private Sub wskMain_DataArrival()
Dim strData as String

wskMain.GetData strData
msgbox strData
End Sub

Client Code:

Private Sub form_load()
wskMain.remotehost = "127.1.0.1"
wskMain.remoteport = 2006
wskMain.senddata "Hello World!"
End Sub

I would think this should work but I have no luck.

Please don't flame if this is something stupid.

TIA

JoshT
Apr 23rd, 2001, 06:24 AM
In UDP with the Winsock control, you have to use the Bind function to set the listening port. I believe the Localport is only applicable to TCP. Look up "Using the Winsock Control" in MSDN for more info.