Changeset 9656 in orxonox.OLD for trunk/src/subprojects
- Timestamp:
- Aug 4, 2006, 11:01:28 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/subprojects/network/network_unit_test.cc
r9494 r9656 52 52 server1 = server.getNewSocket(); 53 53 } 54 54 55 55 assert( server1->isOk() ); 56 56 … … 86 86 printf("%d bytes send from server2\n", n); 87 87 SDL_Delay(10); 88 88 89 89 server.update(); 90 90 … … 120 120 121 121 printf("data: '%s'\n", buf); 122 123 122 123 124 124 //22222222222222222222222222222222222222222 125 125 n = client1->writePacket((byte*)str1, strlen(str1)+1); … … 132 132 printf("%d bytes send from server2\n", n); 133 133 SDL_Delay(10); 134 134 135 135 server.update(); 136 136 … … 181 181 delete client2; 182 182 delete server1; 183 delete server2; 184 183 delete server2; 184 185 185 return 0; 186 186 } … … 238 238 } 239 239 240 bool testCB( Message Id messageId, byte * data, int dataLength, void * someData, int userId )240 bool testCB( MessageType messageType, byte * data, int dataLength, void * someData, int userId ) 241 241 { 242 242 printf("GOT MESSAGE: %s\n", data); … … 259 259 260 260 NetworkManager* netMan = NetworkManager::getInstance(); 261 261 262 262 netMan->initialize(); 263 263 264 264 netMan->createMasterServer(/**ss, */ 9999); 265 265 266 266 SimpleSync* ss = new SimpleSync("Server"); 267 267 ss->setSynchronized( true ); 268 268 269 269 NetworkLog::getInstance()->listen( 8888 ); 270 270 271 271 //MessageManager::getInstance()->initUser( 1 ); 272 272 MessageManager::getInstance()->registerMessageHandler( TESTMESSAGEID, testCB, NULL ); 273 273 274 274 SDL_Delay(20); 275 275 276 276 for(;;) 277 277 { 278 MessageManager::getInstance()->sendMessage( TESTMESSAGEID, (byte*)"server to client", 18, RT_ALL_BUT_ME, 0, MP_HIGHBANDWIDTH );278 MessageManager::getInstance()->sendMessage( TESTMESSAGEID, (byte*)"server to client", 18, RT_ALL_BUT_ME, NET_UNASSIGNED, MP_HIGHBANDWIDTH ); 279 279 netMan->synchronize( 100 ); 280 280 SDL_Delay(100); … … 296 296 State::setOnline(true); 297 297 NetworkManager* netMan = NetworkManager::getInstance(); 298 298 299 299 300 300 netMan->initialize(); 301 301 302 302 std::string host; 303 303 304 304 if ( argc > 2 ) 305 305 host = argv[2]; 306 306 else 307 307 host = "localhost"; 308 308 309 309 netMan->createClient(host, 9999); 310 310 311 311 // SimpleSync* ss = new SimpleSync("SimpleSync"); 312 312 // ss->setSynchronized( true ); 313 313 // netMan->connectSynchronizeable( *ss ); 314 314 315 315 NetworkLog::getInstance()->listen( 7777 ); 316 316 317 317 SimpleSync * ss = NULL; 318 318 319 319 //MessageManager::getInstance()->initUser( 0 ); 320 320 MessageManager::getInstance()->registerMessageHandler( TESTMESSAGEID, testCB, NULL ); 321 321 322 322 for(;;) 323 323 { 324 324 netMan->synchronize( 100 ); 325 MessageManager::getInstance()->sendMessage( TESTMESSAGEID, (byte*)"client to server", 18, RT_ALL_BUT_ME, 0, MP_HIGHBANDWIDTH );325 MessageManager::getInstance()->sendMessage( TESTMESSAGEID, (byte*)"client to server", 18, RT_ALL_BUT_ME, NET_UNASSIGNED, MP_HIGHBANDWIDTH ); 326 326 ss = dynamic_cast<SimpleSync*>(ClassList::getObject( "Server", CL_SIMPLE_SYNC ) ); 327 327 SDL_Delay(100);
Note: See TracChangeset
for help on using the changeset viewer.