src/network/nettest_main.cpp File Reference

#include "tString.h"
#include "nNetwork.h"

Include dependency graph for nettest_main.cpp:

Go to the source code of this file.

Functions

int ntest (const tString &serv, bool server)
int main (int argnum, char **arglist)

Variables

unsigned short client_gamestate [MAXCLIENTS+2]


Function Documentation

int main ( int  argnum,
char **  arglist 
)

Definition at line 35 of file nettest_main.cpp.

References ntest().

00035                                    {
00036     if (argnum<=1){
00037         ntest("",true);
00038     }
00039     else{
00040         ntest(arglist[1],false);
00041     }
00042 }

Here is the call graph for this function:

int ntest ( const tString serv,
bool  server 
)

Definition at line 168 of file nettest.cpp.

References con, floattests, nCLIENT, nSERVER, nSTANDALONE, NULL, nNetObject::RequestSync(), sn_Connect(), sn_GetNetState(), sn_Receive(), sn_SendPlanned(), sn_SetNetState(), nNetObject::SyncAll(), floattest::x, and x.

Referenced by main().

00168                                           {
00169     floattest x;
00170     deptest *y=NULL;
00171 
00172 
00173 
00174     int i=100000;
00175     if (server){
00176         sn_SetNetState(nSERVER);
00177         //y=new deptest(&x);
00178     }
00179     else{
00180         sn_Connect(serv);
00181         i=1000;
00182     }
00183 
00184 
00185     while(i>0 && sn_GetNetState()!=nSTANDALONE){
00186         sn_Receive();
00187         nNetObject::SyncAll();
00188         sn_SendPlanned();
00189 
00190         x.x+=.007;
00191         if (i%10==0){
00192             x.RequestSync();
00193             if (sn_GetNetState()==nCLIENT || i%100==0){
00194                 for(int j=floattests.Len()-1;j>=0;j--){
00195                     floattests[j]->debug_out();
00196                     con << '\t';
00197                 }
00198                 con << '\n';
00199             }
00200         }
00201 
00202         i--;
00203         usleep(10000);
00204 
00205         /*
00206         static int lastprint=0;
00207 
00208         if (current_id%10==0 && current_id!=lastprint){
00209           lastprint=current_id;
00210           con << "netid=" << current_id << '\n';
00211         }
00212         */
00213     }
00214 
00215     if (i==0)
00216         con << "Regular logout..\n";
00217 
00218     sn_SetNetState(nSTANDALONE);
00219     usleep(100000);
00220     sn_Receive();
00221     sn_SendPlanned();
00222 
00223     if (y)
00224         delete y;
00225 
00226     return 0;
00227 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

unsigned short client_gamestate[MAXCLIENTS+2]

Definition at line 31 of file nettest_main.cpp.


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