Changeset 6061 in orxonox.OLD for branches/network
- Timestamp:
- Dec 12, 2005, 2:14:56 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 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; -
branches/network/src/lib/network/network_protocol.h
r6060 r6061 6 6 #define _NETWORK_PROTOCOL_H 7 7 8 /* include base_object.h since all classes are derived from this one */ 8 9 #include "base_object.h" 9 10 … … 11 12 #include "netdefs.h" 12 13 13 #define HEADER_LENGTH 114 15 14 typedef struct Header 16 15 { 17 byte protocol;18 byte version;19 16 byte synchronizeableID; 20 17 byte length;
Note: See TracChangeset
for help on using the changeset viewer.