Changeset 7550 in orxonox.OLD for branches/network
- Timestamp:
- May 6, 2006, 11:09:03 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/subprojects/network/network_unit_test.cc
r6424 r7550 9 9 #include "network_socket.h" 10 10 #include "server_socket.h" 11 #include "udp_server_socket.h" 12 #include "udp_socket.h" 11 13 #include "network_stream.h" 12 14 #include "synchronizeable.h" … … 36 38 int testSocket(int argc, char** argv) 37 39 { 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); 44 43 45 44 NetworkSocket* server1 = server.getNewSocket(); 46 45 47 NetworkSocket* client2 = new NetworkSocket(ip);46 NetworkSocket* client2 = new UdpSocket("localhost", 9999); 48 47 49 48 NetworkSocket* server2 = server.getNewSocket(); … … 144 143 if(error == -1) 145 144 printf("\n\nerror on address resolution, program inconsistancy\n\n"); 146 nm->establishConnection(ip, *clientSync); 145 nm->establishConnection("localhost", port); 146 nm->connectSynchronizeable( *clientSync ); 147 147 /* adding some break for connection setup */ 148 148 SDL_Delay(20); … … 269 269 Synchronizeable* ss = new ReadSync("WriteSync\0"); 270 270 271 netMan->establishConnection(ip, *ss); 271 netMan->establishConnection( name, port ); 272 netMan->connectSynchronizeable( *ss ); 272 273 273 274 for(;;) … … 286 287 void testFloatConverter(float f) 287 288 { 289 #if 0 288 290 char* s = Converter::floatToBinString(f); 289 291 printf("%f = ", f); … … 293 295 printf("Byte Array: "); 294 296 for (int i = 0; i < 4; i++) 295 printf("%i ", res[i]);297 // printf("%i ", res[i]); 296 298 printf("\n"); 297 299 298 300 float b = Converter::byteArrayToFloat(res); 299 301 printf("ReConvert: %f \n", b); 302 #endif 300 303 } 301 304 302 305 void testFloatConverter2(float f) 303 306 { 307 #if 0 304 308 char* s = Converter::floatToBinString(f); 305 309 printf("### %f = ", f); … … 314 318 float b = Converter::_byteArrayToFloat(res); 315 319 printf("ReConvert: %f \n", b); 320 #endif 316 321 } 317 322 int converter(int argc, char** argv)
Note: See TracChangeset
for help on using the changeset viewer.