Changeset 5804 in orxonox.OLD for branches/network/src/lib/network/network_stream.cc
- Timestamp:
- Nov 28, 2005, 5:49:48 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_stream.cc
r5802 r5804 55 55 { 56 56 this->init(); 57 this->networkSocket = new NetworkSocket( address, 9999 ); 58 // this->networkSocket->connectToServer(address, 88); 57 this->networkSocket = new NetworkSocket(address); 59 58 this->networkProtocol = new NetworkProtocol(); 60 59 this->synchronizeables = &sync; … … 63 62 64 63 65 NetworkStream::NetworkStream(Synchronizeable& sync, int port, NodeType type)64 NetworkStream::NetworkStream(Synchronizeable& sync, unsigned int port, NodeType type) 66 65 : DataStream() 67 66 { 68 67 this->init(); 69 this->networkSocket = new NetworkSocket( /* address, type */);70 this->networkSocket->listen( 9999);68 this->networkSocket = new NetworkSocket(); 69 this->networkSocket->listen(port); 71 70 this->networkProtocol = new NetworkProtocol(); 72 71 this->synchronizeables = &sync; … … 94 93 void NetworkStream::processData() 95 94 { 96 97 98 95 int ret = 0; 99 96 100 97 /* DOWNSTREAM */ 101 102 PRINT(0)("\n\n"); 98 printf("\nSynchronizeable: %s\n", this->synchronizeables->getName()); 103 99 PRINT(0)("============= DOWNSTREAM:===============\n"); 104 100 /* first of all read the synchronizeable's data: */ … … 121 117 122 118 /* UPSTREAM */ 123 124 119 ret = 0; 125 120 PRINT(0)("============== UPSTREAM:================\n"); … … 128 123 /* error checking: data read? */ 129 124 printf("NetworkSocket: received %i bytes\n", ret); 130 if( ret != PACKAGE_SIZE + sizeof(Header)) { PRINTF(0)("Error while reading data from the NetworkSocket. Skipping further work\n");}125 if( ret != 11 /*PACKAGE_SIZE + sizeof(Header)*/) { PRINTF(0)("Error while reading data from the NetworkSocket. Skipping further work\n");} 131 126 else 132 127 { … … 135 130 136 131 /* extract Header */ 137 this->networkProtocol->extractHeader((byte*) upBuffer , ret);132 Header header = this->networkProtocol->extractHeader((byte*) upBuffer , ret); 138 133 139 134 /* now pass the data to the sync object */ 140 this->synchronizeables->writeBytes((byte*)upBuffer, ret);135 this->synchronizeables->writeBytes((byte*)upBuffer, header.length); 141 136 } 142 137
Note: See TracChangeset
for help on using the changeset viewer.