#ifdef WIN32
// Windows XP or higher is required for getaddrinfo, but the inclusion of wspiapi provides fallbacks for older versions
+#define _WIN32_WINNT 0x0501
+#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#endif
if (err != 0 || addrinf == NULL)
return 0;
if (addrinf->ai_addr->sa_family != AF_INET6 && addrinf->ai_addr->sa_family != AF_INET)
+ {
+ freeaddrinfo (addrinf);
return 0;
+ }
// great it worked
if (addrinf->ai_addr->sa_family == AF_INET6)
}
else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET4)
{
- unsigned int inetaddresslength;
+ SOCKLEN_T inetaddresslength;
address->addresstype = LHNETADDRESSTYPE_NONE;
inetaddresslength = sizeof(address->addr.in);
value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
}
else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET6)
{
- unsigned int inetaddresslength;
+ SOCKLEN_T inetaddresslength;
address->addresstype = LHNETADDRESSTYPE_NONE;
inetaddresslength = sizeof(address->addr.in6);
value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);