Question

I'm still completely newbie at vb.net. I apologize for my english.

I want to get a gameserver information from server. Server is using GameSpy protocol. In order to get information, you will have to send a request. Server will answer to it and you need to send another packet based of this server response. Then server will send you information. I know what packets to send and what is expected to receive, that is not a problem.

I'm stuck in actually receiving answer from server. With wireshark, I can see that my program correctly sends packet to server AND server responds to it. However, I'm not sure how to get that response to my program.

This is how I send it:

    Dim sock As UdpClient
    Dim ip As String = "5.9.204.5"
    Dim port As Int32 = 2302

    Try
        sock = New UdpClient()
        sock.Connect(ip, port)

        Dim Bytes() As Byte = {&HFE, &HFD, &H9, &HFF, &HFF, &HFF, &H1}
        sock.Send(Bytes, Bytes.Length)

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

Heres screencap of that packet, that server sends to me: http://i.stack.imgur.com/tuXAy.png

How I can receive that packet into my program? I plan to query few other servers aswell, which are on same IP but on different port.

Was it helpful?

Solution

May this sample code will help you pal
Simple UDP Client Sample

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top