Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5647 in orxonox.OLD for branches/network/src/subprojects


Ignore:
Timestamp:
Nov 20, 2005, 12:25:50 AM (19 years ago)
Author:
patrick
Message:

network: modiefied the unit test to enable diffrent modes, extended the NetworkStream constructors interface and NetworkManager interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/subprojects/network/network_unit_test.cc

    r5630 r5647  
    88#include "network_manager.h"
    99#include "network_socket.h"
     10#include "synchronizeable.h"
    1011
    1112int verbose = 4;
    1213
    1314
     15/* outputs the help */
    1416int startHelp(int argc, char** argv)
    1517{
     
    1719  printf(" --help:           this output\n");
    1820  printf(" --sockettest      test network_socket\n");
     21  printf(" --frameworktest   test the network module\n");
    1922  printf("\n");
    2023}
    2124
     25
     26/* test SDL network socket */
    2227int testSocket(int argc, char** argv)
    2328{
     
    107112}
    108113
     114
     115int testFramework(int argc, char** argv)
     116{
     117  printf("=================\n");
     118  printf("TestFramework\n");
     119  printf("=================\n");
     120 
     121  IPaddress ip;
     122  //SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
     123  SDLNet_ResolveHost(&ip, "localhost", 9999);
     124  Synchronizeable sync;
     125 
     126  /* create the network manager */
     127  NetworkManager* nm = new NetworkManager();
     128
     129  /* initialize the network manager */
     130  nm->initialize();
     131
     132  /* esatblish a connection */
     133  nm->establishConnection(ip, sync);
     134 
     135  /* delete the network manager again */
     136  delete nm;
     137 
     138  return 0;
     139}
     140
     141
    109142/**
    110143 *
     
    119152  for(i = 1; i < argc; ++i)
    120153  {
    121     if(! strcmp( "--help", argv[i]) || !strcmp("-h", argv[i])) return startHelp(argc, argv);
    122154    //else if(!strcmp( "--gui", argv[i]) || !strcmp("-g", argv[i])) showGui = true;
    123     else if (! strcmp( "--sockettest", argv[i]) || !strcmp("-s", argv[i])) return testSocket(argc, argv);
     155    if (! strcmp( "--sockettest", argv[i]) || !strcmp("-s", argv[i])) return testSocket(argc, argv);
     156    else if (! strcmp( "--frameworktest", argv[i]) || !strcmp("-s", argv[i])) return testFramework(argc, argv);
    124157  }
    125158
    126   /* create the network manager */
    127   NetworkManager* nm = new NetworkManager();
    128 
    129   /* initialize the network manager */
    130   nm->initialize();
    131 
    132   /* esatblish a connection */
    133   nm->establishConnection();
    134 
    135   //ClassList::debug(3, 0);
    136 
     159  startHelp(argc, argv);
     160 
    137161  return 0;
    138162}
Note: See TracChangeset for help on using the changeset viewer.