Results 1 to 2 of 2

Thread: Winsock UDP

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    1

    Cool

    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
    Anthony Sullivan, MCP, GMT, GST
    Programmer/Analyst

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width