T
tcomer
Hello,
The application that I'm working on sends a request to a server, and
then receives the response via a udp configured socket. It queries a
game server, so I don't have any control over the format or length of
the data received. Everything works as it should, except for handling
the received response. Heres what I have:
1) sock.SendTo(sendBytes, 0, sendBytes.Length, SocketFlags.None, iep);
2) sock.BeginReceive(recBytes, 0, recBytes.Length, SocketFlags.None,
OnBeginReceive, null); // recBytes[4096]
3) string temp = System.Text.Encoding.Default.GetString(recBytes, 0,
recBytes.Length);
4) string results = temp.Replace('\0', '\\');
At line 3, the contents of the temp string is:
"ÿÿinfoResponse\0\a\0\0\0\0\0\0\0\n\0l\0\0si_name\0^8Game Server
Name\0net_serverPunkbusterEnabled\01\0net_serverDedicated
\01\0si_version\0ETQW 1.0.10826.32242 win-x86 Sep 12 2007
20:03:01\0si_gameReviewReadyWait\00\0si_disableGlobalChat
\00\0si_noProficiency\00\0si_allowLateJoin\01\0si_minPlayers
\02\0si_readyPercent\051\0si_disableVoting\00\0si_adminStart
\00\0si_motd_3\0^7#executiveorder on irc.GameSurge.net
\0si_motd_2\0^7http://www.executive-order.net\0si_motd_1\0^7Official
^<CAL ^N6v6 ^7Match Server\0si_irc\0#executiveorder\0si_email
\[email protected]\0si_adminname\0wh0racle.exe\0si_website
\0http://www.executive-order.net\0si_teamForceBalance\01\0si_timelimit
\020\0si_rules\0sdGameRulesStopWatch\0si_spectators\01\0si_pure
\01\0si_needPass\00\0si_teamDamage\01\0si_privateClients
\02\0si_maxPlayers\032\0si_antiLagForgiving\00\0si_antiLagOnly
\00\0si_antiLag\01\0bot_enable\01\0gamename\0baseETQW-1\0si_map\0maps/
area22.entities\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ...continues
to null about 200-300 more times"
.... which is ridiculous in the first place. But at line 4, the
contents of results is nothing except "\\\\\\\\\\\\\\\\\\...etc".
II've tried using Replace, Split, Remove.. none of it works. Any hints
as to why the operations fail?
The application that I'm working on sends a request to a server, and
then receives the response via a udp configured socket. It queries a
game server, so I don't have any control over the format or length of
the data received. Everything works as it should, except for handling
the received response. Heres what I have:
1) sock.SendTo(sendBytes, 0, sendBytes.Length, SocketFlags.None, iep);
2) sock.BeginReceive(recBytes, 0, recBytes.Length, SocketFlags.None,
OnBeginReceive, null); // recBytes[4096]
3) string temp = System.Text.Encoding.Default.GetString(recBytes, 0,
recBytes.Length);
4) string results = temp.Replace('\0', '\\');
At line 3, the contents of the temp string is:
"ÿÿinfoResponse\0\a\0\0\0\0\0\0\0\n\0l\0\0si_name\0^8Game Server
Name\0net_serverPunkbusterEnabled\01\0net_serverDedicated
\01\0si_version\0ETQW 1.0.10826.32242 win-x86 Sep 12 2007
20:03:01\0si_gameReviewReadyWait\00\0si_disableGlobalChat
\00\0si_noProficiency\00\0si_allowLateJoin\01\0si_minPlayers
\02\0si_readyPercent\051\0si_disableVoting\00\0si_adminStart
\00\0si_motd_3\0^7#executiveorder on irc.GameSurge.net
\0si_motd_2\0^7http://www.executive-order.net\0si_motd_1\0^7Official
^<CAL ^N6v6 ^7Match Server\0si_irc\0#executiveorder\0si_email
\[email protected]\0si_adminname\0wh0racle.exe\0si_website
\0http://www.executive-order.net\0si_teamForceBalance\01\0si_timelimit
\020\0si_rules\0sdGameRulesStopWatch\0si_spectators\01\0si_pure
\01\0si_needPass\00\0si_teamDamage\01\0si_privateClients
\02\0si_maxPlayers\032\0si_antiLagForgiving\00\0si_antiLagOnly
\00\0si_antiLag\01\0bot_enable\01\0gamename\0baseETQW-1\0si_map\0maps/
area22.entities\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ...continues
to null about 200-300 more times"
.... which is ridiculous in the first place. But at line 4, the
contents of results is nothing except "\\\\\\\\\\\\\\\\\\...etc".
II've tried using Replace, Split, Remove.. none of it works. Any hints
as to why the operations fail?
That is, the code worked fine, it's just that I made