Various fixes and improvements, backported from Pro version. Code by Erik Zandvliet.

This commit is contained in:
Thulinma 2015-11-05 17:05:21 +01:00
parent 5cce37c521
commit b28a619fc6
13 changed files with 383 additions and 550 deletions

View file

@ -1167,6 +1167,13 @@ int Socket::UDPConnection::bind(int port) {
/// \return True if a packet was received, false otherwise.
bool Socket::UDPConnection::Receive() {
int r = recvfrom(sock, data, data_size, MSG_PEEK | MSG_TRUNC, 0, 0);
if (r == -1){
if (errno != EAGAIN){
INFO_MSG("Found an error: %d (%s)", errno, strerror(errno));
}
data_len = 0;
return false;
}
if (data_size < (unsigned int)r) {
data = (char *)realloc(data, r);
if (data) {