They're not a string, they're the actual binary data.

something like

clientCount = (byte)szRecieveBuffer;

I'm assuming szRecieveBuffer is a char *, given the name...

At 12:07 3/05/2004, you wrote:
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I am playing around with an old proggy I wrote a couple years ago that
connected to a server and did rcon commands (good thing I comment my
code).  I modified it to connect to a server and issue an "info"
command.  Here is the packet the server sends back:
Server responds with the following packet:
            (int32)               -1
            (byte)               ASCII 'C' (info response, S2A_INFO)
            (string)              net address of server
            (string)              name of the host / server
            (string)              name of the map
            (string)              game directory (i.e. valve/)
            (string)              Game description (e.g. "half-life
multiplay")
            (byte)               active client count
            (byte)               maximum clients allowed
            (byte)               protocol version

I am able to parse the packet and get the netaddress, name, directory,
and description.  I can't seem to figure out how to get the client
count, maxplayers, or protocol version.  In the serverprotocol.txt, it
only says that they are bytes.

Here's a snippet of my code:

                        strcpy(netAddress, szRecvBuffer+c);
                        c = c + strlen(netAddress) + 1;
                        strcpy(hostName, szRecvBuffer+c);
                        c = c + strlen(hostName) + 1;
                        strcpy(mapName, szRecvBuffer+c);
                        c = c + strlen(mapName) + 1;
                        strcpy(gameDir, szRecvBuffer+c);
                        c = c + strlen(gameDir) + 1;
                        strcpy(gameDesc, szRecvBuffer+c);
                        c = c + strlen(gameDesc) + 1;
                        strcpy(clientCount, szRecvBuffer+c);
                        c = c + strlen(clientCount) + 1;

The part where I parse the clientCount does not work.

I want to make this program ping all of my half life servers (100+),
outputting some brief info, and issuing an alert when one goes down.  Of
course, I will share when complete.

Dave

--


_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders


----------
Programmer The Pok�mod
http://pokemod.687th.com

----------


_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to