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); |