Changeset 7565 in orxonox.OLD for branches/network/src/subprojects
- Timestamp:
- May 10, 2006, 1:13:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/subprojects/network/network_unit_test.cc
r7556 r7565 42 42 NetworkSocket* client1 = new UdpSocket("localhost", 9999); 43 43 44 client1->writePacket( (byte*)"test", 5 );45 44 NetworkSocket* server1 = NULL; 46 45 while ( server1 == NULL ) 46 { 47 server.update(); 47 48 server1 = server.getNewSocket(); 49 } 48 50 49 51 assert( server1->isOk() ); … … 51 53 NetworkSocket* client2 = new UdpSocket("localhost", 9999); 52 54 53 client2->writePacket( (byte*)"test", 5 );54 55 NetworkSocket* server2 = NULL; 55 56 while ( server2 == NULL ) 57 { 58 server.update(); 56 59 server2 = server.getNewSocket(); 60 } 57 61 58 62 char buf[1024]; … … 77 81 n = server2->writePacket((byte*)str4, strlen(str4)+1); 78 82 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(); 80 132 81 133 printf("read from server1\n");
Note: See TracChangeset
for help on using the changeset viewer.