src/network/astat.cpp File Reference

#include "nServerInfo.h"
#include "nNetwork.h"
#include "tConsole.h"
#include "tDirectories.h"
#include "tLocale.h"
#include "nSocket.h"
#include "tCommandLine.h"
#include <iostream>

Include dependency graph for astat.cpp:

Go to the source code of this file.

Classes

class  nCon

Functions

void Poll ()
int main (int argc, char **argv)

Variables

static nCon ncon


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 83 of file astat.cpp.

References tCommandLineData::Analyse(), tLocale::Clear(), nServerInfo::GetFromMaster(), tLocale::Load(), Poll(), tCommandLineData::programVersion_, nBasicNetworkSystem::Shutdown(), sn_BasicNetworkSystem, and sn_programVersion.

00084 {
00085     // get the list
00086     //  nServerInfo::GetFromLAN();          // or rather from the local net
00087     //  std::cout << "LAN:\n";
00088     //  Poll();
00089 
00090     tCommandLineData commandLine;
00091     commandLine.programVersion_  = &sn_programVersion;
00092     commandLine.Analyse(argc, argv);
00093     tLocale::Load("languages.txt");
00094 
00095     nServerInfo::GetFromMaster();   // from the master server
00096     //  std::cout << "MASTER:\n";
00097     Poll();
00098 
00099     tLocale::Clear();
00100     sn_BasicNetworkSystem.Shutdown();
00101 }

Here is the call graph for this function:

void Poll (  ) 

Definition at line 53 of file astat.cpp.

References nServerInfo::DeleteAll(), nServerInfo::DoQueryAll(), nServerInfoBase::GetConnectionName(), nServerInfo::GetFirstServer(), nServerInfoBase::GetPort(), tListItem< T >::Next(), nSTANDALONE, nServerInfo::Ping(), nServerInfo::Reachable(), sn_SetNetState(), nServerInfo::StartQueryAll(), and nServerInfo::Users().

Referenced by main().

00054 {
00055     // poll the servers
00056     nServerInfo::StartQueryAll();
00057     while (nServerInfo::DoQueryAll(10)) usleep(1000);
00058     sn_SetNetState(nSTANDALONE);
00059 
00060     int servers = 0, users = 0;
00061 
00062     // print the list
00063     nServerInfo* run = nServerInfo::GetFirstServer();
00064     while (run)
00065     {
00066 
00067         std::cout << run->GetConnectionName() << "\t" << run->GetPort() << "\t"
00068         << run->Users() << "\t" << run->Ping() << "\n";
00069 
00070         servers += run->Reachable() ? 1 : 0;
00071         users += run->Users();
00072 
00073         run = run->Next();
00074     }
00075 
00076     std::cout << "\nservers: " << servers
00077     << "\nusers  : " << users << "\n";
00078 
00079     nServerInfo::DeleteAll();
00080 
00081 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

nCon ncon [static]

Definition at line 48 of file astat.cpp.


Generated on Sat Mar 15 23:00:07 2008 for Armagetron Advanced by  doxygen 1.5.4