in reply to Re: Simple UDP example anyone?
in thread Simple UDP example anyone?

Hi! I've been looking for UDP exampels as well, and i finally found it here! Thanks! But i'm having some problems with your send/receive script:( In my case i'm trying to query a game server (TF2). It runs on port 27015, so i changed PeerPort to 27015 and PeerAddr to my server ip. To get A2S_INFO (number of players, map, server name etc) i have to send a request UDP packet with the following info: "FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69 6E 65 20 51 75 65 72 79 00 Source Engine Query". When the server gets this packet is should respond by sending this server info back. However, when i run the script nothing happens. It doesn't print anything:( I'm not sure about the LocalPort.. Nevertheless, i've been stuck with this for a long time now, and no one can help me out. Therefore i seek the wisdom of the monks. Thanks in advance! Url to the query protocol for those who are interested:

Replies are listed 'Best First'.
Re^3: Simple UDP example anyone?
by ctilmes (Vicar) on Feb 15, 2008 at 16:38 UTC
    Are you sending that as a string, or are you 'pack'ing the bytes? Post your code for constructing the packet.
      Hi! First i sent it as string (my bad), but know i send it as bytes (the right way).
      $sock->send("\xFF\xFF\xFF\xFFTSource Engine Query\x00");
      But still no answer :/ Been stuck with this like 3 days now:(
        Errr i mean "now", just had to make things right. I hate typos :p
Re^3: Simple UDP example anyone?
by Anonymous Monk on Feb 14, 2008 at 17:37 UTC
    Hmm, strange. I only posted once :(