{
ret_port= default_port;
int sd;
- if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != -1)
+ if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != SOCKET_ERROR)
{
int optval= 1;
- if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != -1)
+ if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != SOCKET_ERROR)
{
struct sockaddr_in sin;
sin.sin_port= 0;
int bind_ret;
do
{
- if ((bind_ret= bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in) )) != -1)
+ if ((bind_ret= bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in) )) != SOCKET_ERROR)
{
socklen_t addrlen= sizeof(sin);
// We handle the case where if we max out retries, we still abort.
if (retries == 0)
{
- fatal_message("No port could be found, exhausted retry");
+ FATAL("No port could be found, exhausted retry");
}
if (ret_port == 0)
{
- fatal_message("No port could be found");
+ FATAL("No port could be found");
}
if (ret_port == default_port)
{
- fatal_message("No port could be found");
+ FATAL("No port could be found");
}
if (ret_port <= 1024)
{
- fatal_message("No port could be found, though some where available below or at 1024");
+ FATAL("No port could be found, though some where available below or at 1024");
}
all_socket_fd.last_port= ret_port;