Chris's patch

This commit is contained in:
Ruslan Kuchumov 2014-08-09 20:52:15 +00:00
parent 3347f5d345
commit aa2c316093
2 changed files with 4 additions and 5 deletions

View File

@ -883,12 +883,11 @@ int start_upd_srv(const char *addr_str, unsigned port)
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
servaddr.sin_family = AF_INET; servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = addr;
servaddr.sin_port = htons(port); servaddr.sin_port = htons(port);
if (IN_MULTICAST(addr)) if (IN_MULTICAST(addr))
servaddr.sin_addr.s_addr = addr; servaddr.sin_addr.s_addr = htonl(addr);
else else
servaddr.sin_addr.s_addr = INADDR_ANY; servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0) if (bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0)
{ {
@ -904,7 +903,7 @@ int start_upd_srv(const char *addr_str, unsigned port)
struct ip_mreq group; struct ip_mreq group;
group.imr_multiaddr.s_addr = htonl(addr); group.imr_multiaddr.s_addr = htonl(addr);
group.imr_interface.s_addr = htonl(INADDR_ANY); group.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(infd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0) if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0)
{ {
#if _WIN32 #if _WIN32
wprintf(L"setsockopt() error: %ld\n", WSAGetLastError()); wprintf(L"setsockopt() error: %ld\n", WSAGetLastError());

View File

@ -18,7 +18,7 @@ void params_dump(void)
mprint ("Network, UDP/%u",ccx_options.udpport); mprint ("Network, UDP/%u",ccx_options.udpport);
else else
{ {
mprint ("Network, %s:%d",ccx_options.udpport, ccx_options.udpport); mprint ("Network, %s:%d",ccx_options.udpaddr, ccx_options.udpport);
} }
break; break;
case CCX_DS_TCP: case CCX_DS_TCP: