miniupnpc.c: use unsigned long for IP_MULTICAST_TTL with win32

fixes 1da63faa4f for win32
This commit is contained in:
Thomas Bernard 2015-08-26 18:47:27 +02:00
parent 739e0b914a
commit aba8c3f3d7
1 changed files with 5 additions and 0 deletions

View File

@ -381,6 +381,7 @@ upnpDiscoverDevices(const char * const deviceTypes[],
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
MIB_IPFORWARDROW ip_forward; MIB_IPFORWARDROW ip_forward;
unsigned long _ttl = (unsigned long)ttl;
#endif #endif
int linklocal = 1; int linklocal = 1;
@ -528,7 +529,11 @@ upnpDiscoverDevices(const char * const deviceTypes[],
return NULL; return NULL;
} }
#ifdef _WIN32
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &_ttl, sizeof(_ttl)) < 0)
#else /* _WIN32 */
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
#endif /* _WIN32 */
{ {
/* not a fatal error */ /* not a fatal error */
PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)"); PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");