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:
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.