the first feedback for this fresh project :)
ok, consider the gsinfo tool available here:
http://mirror.aluigi.org/papers/gsinfo.zip
(it's a tool for querying game servers using the old \status\ and the gamespy 2 protocol)
Now, if you want to query a terminator 3 server you will fail since almost all the public servers of this game are behind NAT or router.
So I used the following command and it failed:
Code:
C:\>gsinfo 1.2.3.4 60005 1
GSInfo (Gamepsy querying protocol) 0.4
by Luigi Auriemma
e-mail: aluigi@autistici.org
web: aluigi.org
Waiting 3 seconds for a reply
Error: timeout
so I added at line 120 of gsinfo.c the following line:
Code:
if(gsnatneg(sd, "terminator3", NULL, peer.sin_addr.s_addr, ntohs(peer.sin_port)) < 0) {
printf("- natneg failed\n");
exit(1);
}
recompiled and the following is the successful result:
Code:
C:\>gsinfo 1.2.3.4 60005 1
GSInfo (Gamepsy querying protocol) 0.4
by Luigi Auriemma
e-mail: aluigi@autistici.org
web: aluigi.org
Waiting 3 seconds for a reply
hostname: myriam
gamever: 850
mapname: PALYA3
gametype: 1
numplayers: 1
maxplayers: 32
:
:
:
:
naturally I suggest to skip the packets from the game server which start with the bytes fd fc since they are related to natneg, although my function already handles them (in fact I had no problems during my example) in some occasions could happen that they reach your socket