Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7550 in orxonox.OLD for branches/network/src


Ignore:
Timestamp:
May 6, 2006, 11:09:03 AM (19 years ago)
Author:
rennerc
Message:

subprojects/network uses should test net network sockets now

File:
1 edited

Legend:

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

    r6424 r7550  
    99#include "network_socket.h"
    1010#include "server_socket.h"
     11#include "udp_server_socket.h"
     12#include "udp_socket.h"
    1113#include "network_stream.h"
    1214#include "synchronizeable.h"
     
    3638int testSocket(int argc, char** argv)
    3739{
    38   IPaddress ip;
    39   SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
    40   ServerSocket server;
    41   server.listen(9999);
    42 
    43   NetworkSocket* client1 = new NetworkSocket(ip);
     40  UdpServerSocket server(9999);
     41
     42  NetworkSocket* client1 = new UdpSocket("localhost", 9999);
    4443
    4544  NetworkSocket* server1 = server.getNewSocket();
    4645
    47   NetworkSocket* client2 = new NetworkSocket(ip);
     46  NetworkSocket* client2 = new UdpSocket("localhost", 9999);
    4847
    4948  NetworkSocket* server2 = server.getNewSocket();
     
    144143  if(error == -1)
    145144    printf("\n\nerror on address resolution, program inconsistancy\n\n");
    146   nm->establishConnection(ip, *clientSync);
     145  nm->establishConnection("localhost", port);
     146  nm->connectSynchronizeable( *clientSync );
    147147  /* adding some break for connection setup */
    148148  SDL_Delay(20);
     
    269269  Synchronizeable* ss = new ReadSync("WriteSync\0");
    270270
    271   netMan->establishConnection(ip, *ss);
     271  netMan->establishConnection( name, port );
     272  netMan->connectSynchronizeable( *ss );
    272273
    273274  for(;;)
     
    286287void testFloatConverter(float f)
    287288{
     289#if 0
    288290  char* s = Converter::floatToBinString(f);
    289291  printf("%f = ", f);
     
    293295  printf("Byte Array: ");
    294296  for (int i = 0; i < 4; i++)
    295     printf("%i  ", res[i]);
     297//    printf("%i  ", res[i]);
    296298  printf("\n");
    297299
    298300  float b = Converter::byteArrayToFloat(res);
    299301  printf("ReConvert: %f \n", b);
     302#endif
    300303}
    301304
    302305void testFloatConverter2(float f)
    303306{
     307#if 0
    304308  char* s = Converter::floatToBinString(f);
    305309  printf("### %f = ", f);
     
    314318  float b = Converter::_byteArrayToFloat(res);
    315319  printf("ReConvert: %f \n", b);
     320#endif
    316321}
    317322int converter(int argc, char** argv)
Note: See TracChangeset for help on using the changeset viewer.