Network/Socket: Fix IPv6 handling

This commit is contained in:
Jérôme Leclercq 2017-07-11 12:11:43 +02:00
parent b4732d8c17
commit 9fb9289d6e
1 changed files with 2 additions and 2 deletions

View File

@ -509,12 +509,12 @@ namespace Nz
NazaraAssert(buffer && length > 0, "Invalid buffer"); NazaraAssert(buffer && length > 0, "Invalid buffer");
IpAddressImpl::SockAddrBuffer nameBuffer; IpAddressImpl::SockAddrBuffer nameBuffer;
socklen_t bufferLength = sizeof(sockaddr_in); socklen_t bufferLength = static_cast<socklen_t>(nameBuffer.size());
IpAddress senderIp; IpAddress senderIp;
int byteRead = recvfrom(handle, buffer, length, 0, reinterpret_cast<sockaddr*>(&nameBuffer), &bufferLength); int byteRead = recvfrom(handle, buffer, length, 0, reinterpret_cast<sockaddr*>(&nameBuffer), &bufferLength);
if (byteRead == SOCKET_ERROR) if (byteRead == -1)
{ {
int errorCode = GetLastErrorCode(); int errorCode = GetLastErrorCode();
if (errorCode == EAGAIN) if (errorCode == EAGAIN)