Changeset 5747 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- Nov 23, 2005, 11:32:20 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/data_stream.h
r5728 r5747 13 13 #include "netdefs.h" 14 14 15 #define DATA_STREAM_BUFFER_SIZE 1024 16 15 17 class DataStream : public BaseObject 16 18 { … … 18 20 DataStream(); 19 21 DataStream(DataStream& inStream, DataStream& outStream); 20 21 22 ~DataStream(); 22 23 23 24 24 25 void connectUpStream(DataStream& upStream); … … 37 38 int passUp(byte* data); 38 39 39 byte* upBuffer [ 1024];40 byte* downBuffer [ 1024];40 byte* upBuffer [DATA_STREAM_BUFFER_SIZE]; 41 byte* downBuffer [DATA_STREAM_BUFFER_SIZE]; 41 42 unsigned int bufferSize; 42 43 DataStream* upStream; -
branches/network/src/lib/network/network_stream.cc
r5746 r5747 19 19 */ 20 20 #define DEBUG_MODULE_NETWORK 21 #define PACKAGE_SIZE 256 21 22 22 23 23 #include "base_object.h" … … 35 35 using namespace std; 36 36 37 38 #define PACKAGE_SIZE 256 37 39 38 40 … … 102 104 103 105 /* send the received data to connectionMonitor */ 104 this->connectionMonitor->processPacket((byte*)downBuffer, PACKAGE_SIZE);106 this->connectionMonitor->processPacket((byte*)downBuffer, ret + sizeof(Header)); 105 107 106 this->networkProtocol->createHeader((byte*) downBuffer , PACKAGE_SIZE , 1024,*(this->synchronizeables),12); 108 this->networkProtocol->createHeader((byte*)downBuffer, ret, DATA_STREAM_BUFFER_SIZE, 109 *(this->synchronizeables), 12); 107 110 108 111 /* pass the data to the network socket */ … … 119 122 /* first of all read data from networkSocket*/ 120 123 while(ret == 0) 121 ret = this->networkSocket->readBlock((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header));124 ret = this->networkSocket->readBlock((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header)); 122 125 /* error checking: data read? */ 123 if( ret != PACKAGE_SIZE ) { PRINTF(0)("Error while reading data from the NetworkSocket\n");}126 if( ret != PACKAGE_SIZE + sizeof(Header)) { PRINTF(0)("Error while reading data from the NetworkSocket\n");} 124 127 125 128 /* send the received data to connectionMonitor */ … … 130 133 131 134 /* now pass the data to the sync object */ 132 this->synchronizeables->writeBytes((byte*)upBuffer [sizeof(Header)], PACKAGE_SIZE);135 this->synchronizeables->writeBytes((byte*)upBuffer, PACKAGE_SIZE); 133 136 134 137 }
Note: See TracChangeset
for help on using the changeset viewer.