sources/network/udpsocket.cpp

branch
protocol5
changeset 171
d0fba0d7ad03
parent 159
970d58a01e8b
child 172
0b0bc8045d28
child 195
be953e1621d9
equal deleted inserted replaced
170:40d8d7231a36 171:d0fba0d7ad03
127 m_error = String ("recvfrom error: ") + strerror (errno); 127 m_error = String ("recvfrom error: ") + strerror (errno);
128 128
129 return false; 129 return false;
130 } 130 }
131 131
132 if (length < 4)
133 {
134 m_error = "The server sent a too short packet";
135 return false;
136 }
137
138 unsigned char decodedPacket[MAX_DATAGRAM_LENGTH]; 132 unsigned char decodedPacket[MAX_DATAGRAM_LENGTH];
139 int decodedLength = sizeof decodedPacket; 133 int decodedLength = sizeof decodedPacket;
140 HUFFMAN_Decode (reinterpret_cast<unsigned char*> (HuffmanBuffer), 134 HUFFMAN_Decode (reinterpret_cast<unsigned char*> (HuffmanBuffer),
141 decodedPacket, length, &decodedLength); 135 decodedPacket, length, &decodedLength);
142 datagram.address.host = ntohl (claddr.sin_addr.s_addr); 136 datagram.address.host = ntohl (claddr.sin_addr.s_addr);

mercurial