#else
s = inet_ntoa( ((struct sockaddr_in *) *sal)->sin_addr );
#endif
- port = ((struct sockaddr_in *)*sal) ->sin_port;
+ port = ntohs( ((struct sockaddr_in *)*sal) ->sin_port );
l.sl_name = ch_malloc( sizeof("IP=255.255.255.255:65535") );
sprintf( l.sl_name, "IP=%s:%d",
s != NULL ? s : "unknown" , port );
char addr[INET6_ADDRSTRLEN];
inet_ntop( AF_INET6, &((struct sockaddr_in6 *)*sal)->sin6_addr,
addr, sizeof addr);
- port = ((struct sockaddr_in6 *)*sal)->sin6_port;
+ port = ntohs( ((struct sockaddr_in6 *)*sal)->sin6_port );
l.sl_name = ch_malloc( strlen(addr) + sizeof("IP= 65535") );
sprintf( l.sl_name, "IP=%s %d", addr, port );
} break;