Changeset 6061 in orxonox.OLD for branches/network/src/lib/network/network_protocol.cc
- Timestamp:
- Dec 12, 2005, 2:14:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_protocol.cc
r6060 r6061 67 67 return -1; 68 68 69 // for(int i = 0; i < length; i++)70 // printf("send byte[%i]=%u\n", i, data[i]);71 69 72 73 //Create space for the header 70 // FIXME: without move Create space for the header 74 71 for( int i = length - 1; i >= 0; i--) 75 72 data[i + this->headerLength] = data[i]; 76 73 77 74 //Now create the header 78 /* protocol identifier */79 data[0] = 255;80 /* version number */81 data[1] = 0;82 75 /* sender ID: FIXME: there will be a better ID (for example unique:D)*/ 83 data[ 2] = (byte)(source.getUniqueID());76 data[0] = (byte)(source.getUniqueID()); 84 77 /* data length*/ 85 data[ 3] = length;78 data[1] = length; 86 79 87 80 … … 103 96 PRINTF(0)("Received data is to short; it can't contain a header!\n"); 104 97 Header h; 105 h. protocol= 0;98 h.length = 0; 106 99 return h; 107 100 } … … 111 104 //&h = data; 112 105 113 h.protocol = data[0];114 /* version number */115 h.version = data[1];116 106 /* unique ID */ 117 h.synchronizeableID = data[ 2];107 h.synchronizeableID = data[0]; 118 108 /* data length*/ 119 h.length = data[ 3];109 h.length = data[1]; 120 110 121 122 // for(int i = 0; i < length; i++)123 // printf("recS byte[%i]=%u\n", i, data[i]);124 125 //Remove header126 // for (int i = headerLength; i < length; i++)127 // data[i - headerLength] = data[i];128 111 129 112 return h;
Note: See TracChangeset
for help on using the changeset viewer.