src/network/nettest.cpp File Reference

#include "config.h"
#include "nNetwork.h"
#include "nNet.h"
#include <string>
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include "nNetObject.h"

Include dependency graph for nettest.cpp:

Go to the source code of this file.

Classes

class  floattest
class  deptest

Functions

int ntest (const tString &serv, bool server)

Variables

List< floattestfloattests
nNOInitialisator< floattestfloattest_init (200,"floattest")
List< deptest, false, true > deptests
nNOInitialisator< deptestdeptest_init ("deptest")


Function Documentation

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

nNOInitialisator<deptest> deptest_init("deptest")

List<deptest, false, true> deptests

Definition at line 107 of file nettest.cpp.

Referenced by deptest::deptest(), and deptest::~deptest().

nNOInitialisator<floattest> floattest_init(200,"floattest")

List<floattest> floattests

Definition at line 49 of file nettest.cpp.

Referenced by floattest::floattest(), ntest(), and floattest::~floattest().


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