Changeset 6026 in orxonox.OLD for branches/network/src/subprojects
- Timestamp:
- Dec 10, 2005, 9:57:51 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/subprojects/network/network_unit_test.cc
r6025 r6026 40 40 server.listen(9999); 41 41 42 NetworkSocket client1(ip);42 NetworkSocket* client1 = new NetworkSocket(ip); 43 43 44 44 NetworkSocket* server1 = server.getNewSocket(); 45 45 46 NetworkSocket client2(ip);46 NetworkSocket* client2 = new NetworkSocket(ip); 47 47 48 48 NetworkSocket* server2 = server.getNewSocket(); … … 51 51 52 52 printf("read from client1 before sending data\n"); 53 printf("result: %d bytes\n", client1 .readPacket((byte*)buf, 1024));53 printf("result: %d bytes\n", client1->readPacket((byte*)buf, 1024)); 54 54 55 55 printf("read from client2 before sending data\n"); 56 printf("result: %d bytes\n", client2 .readPacket((byte*)buf, 1024));56 printf("result: %d bytes\n", client2->readPacket((byte*)buf, 1024)); 57 57 58 58 int n; … … 61 61 char * str3 = "client2 to server"; 62 62 char * str4 = "server2 to client"; 63 n = client1 .writePacket((byte*)str1, strlen(str1)+1);63 n = client1->writePacket((byte*)str1, strlen(str1)+1); 64 64 printf("%d bytes send from client1\n", n); 65 65 n = server1->writePacket((byte*)str2, strlen(str2)+1); 66 66 printf("%d bytes send from server1\n", n); 67 n = client2 .writePacket((byte*)str3, strlen(str3)+1);67 n = client2->writePacket((byte*)str3, strlen(str3)+1); 68 68 printf("%d bytes send from client2\n", n); 69 69 n = server2->writePacket((byte*)str4, strlen(str4)+1); … … 88 88 89 89 printf("read from client1\n"); 90 n = client1 .readPacket((byte*)buf, 1024);90 n = client1->readPacket((byte*)buf, 1024); 91 91 printf("read %d bytes\n", n); 92 92 if (n<0) … … 96 96 97 97 printf("read from client2\n"); 98 n = client2 .readPacket((byte*)buf, 1024);98 n = client2->readPacket((byte*)buf, 1024); 99 99 printf("read %d bytes\n", n); 100 100 if (n<0) … … 106 106 107 107 printf("try to send more than 255 bytes\n"); 108 printf("result: %d\n", client1 .writePacket((byte*)buf, 1000));108 printf("result: %d\n", client1->writePacket((byte*)buf, 1000)); 109 109 110 110 server1->writePacket((byte*)str1, strlen(str1)+1); 111 111 SDL_Delay(500); 112 112 printf("try to read with a too small buffer\n"); 113 printf("result: %d\n", client1 .readPacket((byte*)buf, strlen(str1)));113 printf("result: %d\n", client1->readPacket((byte*)buf, strlen(str1))); 114 114 115 115 return 0;
Note: See TracChangeset
for help on using the changeset viewer.