Determining Server Status?
by Bruce Wallace · in Torque Game Engine · 03/22/2003 (1:13 pm) · 3 replies
Hello,
I am looking for information on resolving a server's status.
Is the Server::Status variable still being used at all?
The setServerInfo function returns a ServerInfo::Status that ends up being a number.
1073741825 was returned.
then:
1073741827 (only differance was password flag was set)
I know flags are represented here but any information on decoding it would be appriciated.
thanks,
Bruce
I am looking for information on resolving a server's status.
Is the Server::Status variable still being used at all?
The setServerInfo function returns a ServerInfo::Status that ends up being a number.
1073741825 was returned.
then:
1073741827 (only differance was password flag was set)
I know flags are represented here but any information on decoding it would be appriciated.
thanks,
Bruce
About the author
#2
The simplest way is to determine the bit you want to check, and then do something along these lines:
(If you wanted to check the 5th bit).
You might be well serverd to bone up a bit on your binary math :)
03/24/2003 (11:20 am)
I believe that game\net\serverQuery.cc has the information you need. The number must be "decoded" to get to the individual bits.The simplest way is to determine the bit you want to check, and then do something along these lines:
if(Server::Status & (1<<5))
(If you wanted to check the 5th bit).
You might be well serverd to bone up a bit on your binary math :)
#3
I took some time and reviewed binary math and in the end, I decided to bypass decoding that number to get the flags I was interested in. and just add some more variables to the setServerInfo console function as so:
and looking further into the ServerInfo::State, I found that in common/server.cs the variable was being returned as "Doing Ok" in the following function. I changed that to $Server::Status as so:
Edit: forgot something
Bruce
03/24/2003 (3:45 pm)
Thanks for the responses,I took some time and reviewed binary math and in the end, I decided to bypass decoding that number to get the flags I was interested in. and just add some more variables to the setServerInfo console function as so:
Con::setBoolVariable("ServerInfo::Linux",info.isLinux());
Con::setBoolVariable("ServerInfo::Responded",info.hasResponded());
Con::setBoolVariable("ServerInfo::TimedOut",info.isTimedOut());
Con::setBoolVariable("ServerInfo::Querying",info.isQuerying());
Con::setBoolVariable("ServerInfo::New",info.isNew());and looking further into the ServerInfo::State, I found that in common/server.cs the variable was being returned as "Doing Ok" in the following function. I changed that to $Server::Status as so:
function onServerInfoQuery()
{
// When the server is queried for information, the value
// of this function is returned as the status field of
// the query packet. This information is accessible as
// the ServerInfo::State variable.
return $Server::Status;
}Hope this information helps someone, I have more digging to do.Edit: forgot something
Bruce
Torque Owner Chris \"Hobbiticus\" Weiland
If that doesn't help, then it's probably broken and you'll have to fix it yourself :\