Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 10, 2006, 1:13:49 PM (19 years ago)
Author:
rennerc
Message:

reimplemented NetworkStream

File:
1 edited

Legend:

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

    r7556 r7565  
    4242  NetworkSocket* client1 = new UdpSocket("localhost", 9999);
    4343
    44   client1->writePacket( (byte*)"test", 5 );
    4544  NetworkSocket* server1 = NULL;
    4645  while ( server1 == NULL )
     46  {
     47    server.update();
    4748    server1 = server.getNewSocket();
     49  }
    4850 
    4951  assert( server1->isOk() );
     
    5153  NetworkSocket* client2 = new UdpSocket("localhost", 9999);
    5254
    53   client2->writePacket( (byte*)"test", 5 );
    5455  NetworkSocket* server2 = NULL;
    5556  while ( server2 == NULL )
     57  {
     58    server.update();
    5659    server2 = server.getNewSocket();
     60  }
    5761
    5862  char buf[1024];
     
    7781  n = server2->writePacket((byte*)str4, strlen(str4)+1);
    7882  printf("%d bytes send from server2\n", n);
    79   SDL_Delay(1000);
     83  SDL_Delay(10);
     84 
     85  server.update();
     86
     87  printf("read from server1\n");
     88  n = server1->readPacket((byte*)buf, 1024);
     89  printf("read %d bytes\n", n);
     90  if (n<0)
     91    return -1;
     92
     93  printf("data: '%s'\n", buf);
     94
     95  printf("read from server2\n");
     96  n = server2->readPacket((byte*)buf, 1024);
     97  printf("read %d bytes\n", n);
     98  if (n<0)
     99    return -1;
     100
     101  printf("data: '%s'\n", buf);
     102
     103  printf("read from client1\n");
     104  n = client1->readPacket((byte*)buf, 1024);
     105  printf("read %d bytes\n", n);
     106  if (n<0)
     107    return -1;
     108
     109  printf("data: '%s'\n", buf);
     110
     111  printf("read from client2\n");
     112  n = client2->readPacket((byte*)buf, 1024);
     113  printf("read %d bytes\n", n);
     114  if (n<0)
     115    return -1;
     116
     117  printf("data: '%s'\n", buf);
     118 
     119 
     120  //22222222222222222222222222222222222222222
     121  n = client1->writePacket((byte*)str1, strlen(str1)+1);
     122  printf("%d bytes send from client1\n", n);
     123  n = server1->writePacket((byte*)str2, strlen(str2)+1);
     124  printf("%d bytes send from server1\n", n);
     125  n = client2->writePacket((byte*)str3, strlen(str3)+1);
     126  printf("%d bytes send from client2\n", n);
     127  n = server2->writePacket((byte*)str4, strlen(str4)+1);
     128  printf("%d bytes send from server2\n", n);
     129  SDL_Delay(10);
     130 
     131  server.update();
    80132
    81133  printf("read from server1\n");
Note: See TracChangeset for help on using the changeset viewer.