libs/stream_message/src/transport.cxx
// ===========================================================================
// This procedure will create a listen socket for client requests 
// channel and for admin requests channel.
// -- code from paraset/src/serverspy/serverspy.cpp --
//
This procedure will create a listen socket for client requests
channel and for admin requests channel.
This procedure will create a listen socket for client requests channel and for admin requests channel .
static int CreateListener() {
    int sock;
    struct sockaddr_in name;
    sock = create_socket();
    if (sock < 0) return -1;
    name.sin_family      = AF_INET;
    name.sin_port        = 0;
    name.sin_addr.s_addr = htonl(INADDR_ANY);
    if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
	return -1;
    if(listen(sock, 5) < 0) return -1;
    return sock;
}
static int CreateListener ( ) { int sock ; struct sockaddr_in name ; sock = create_socket ( ) ; if ( sock < 0 ) return -1 ; name . sin_family = AF_INET ; name . sin_port = 0 ; name . sin_addr . s_addr = htonl ( INADDR_ANY ) ; if ( bind ( sock , ( struct sockaddr * ) & name , sizeof ( name ) ) < 0 ) return -1 ; if ( listen ( sock , 5 ) < 0 ) return -1 ; return sock ; }
This procedure will create a listen socket for client requests
channel and for admin requests channel.
This procedure will create a listen socket for client requests channel and for admin requests channel .
/* Create the socket. */ // unsigned int set_option = 1; // setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&set_option, sizeof(set_option)); /* Give the socket a name. */