diff --git a/src/networking.c b/src/networking.c index 32d94885..bfa4890d 100644 --- a/src/networking.c +++ b/src/networking.c @@ -883,12 +883,11 @@ int start_upd_srv(const char *addr_str, unsigned port) struct sockaddr_in servaddr; servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = addr; servaddr.sin_port = htons(port); if (IN_MULTICAST(addr)) - servaddr.sin_addr.s_addr = addr; + servaddr.sin_addr.s_addr = htonl(addr); 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) { @@ -904,7 +903,7 @@ int start_upd_srv(const char *addr_str, unsigned port) struct ip_mreq group; group.imr_multiaddr.s_addr = htonl(addr); 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 wprintf(L"setsockopt() error: %ld\n", WSAGetLastError()); diff --git a/src/params_dump.c b/src/params_dump.c index 0c986905..2893296a 100644 --- a/src/params_dump.c +++ b/src/params_dump.c @@ -18,7 +18,7 @@ void params_dump(void) mprint ("Network, UDP/%u",ccx_options.udpport); else { - mprint ("Network, %s:%d",ccx_options.udpport, ccx_options.udpport); + mprint ("Network, %s:%d",ccx_options.udpaddr, ccx_options.udpport); } break; case CCX_DS_TCP: