STCP/network_io_tcp.c
int _network_init(mysock_context_t *sock_ctx, network_context_t *net_ctx)
{
    network_context_socket_tcp_t *tcp_io_ctx;
    int rc;

    assert(sock_ctx && net_ctx);
    if ((rc = _network_init_socket(sock_ctx,
                                   net_ctx,
                                   SOCK_STREAM,
                                   sizeof(network_context_socket_tcp_t))) < 0)
        return rc;

    tcp_io_ctx = (network_context_socket_tcp_t *) net_ctx->impl_data;
    assert(tcp_io_ctx);

    tcp_io_ctx->sock_ctx = sock_ctx;
    tcp_io_ctx->new_socket = -1;
    tcp_io_ctx->connected = FALSE;

    PTHREAD_CALL(pthread_mutex_init(&tcp_io_ctx->connect_lock, NULL));

    return 0;
}
/* initialise the network subsystem.  this function should be called before
 * making use of any of the other network layer functions.
 */
initialise the network subsystem.  this function should be called before
making use of any of the other network layer functions.
initialise the network subsystem . this function should be called before making use of any of the other network layer functions .
int _network_init(mysock_context_t *sock_ctx, network_context_t *net_ctx)
{
    network_context_socket_tcp_t *tcp_io_ctx;
    int rc;
    assert(sock_ctx && net_ctx);
    if ((rc = _network_init_socket(sock_ctx,
                                   net_ctx,
                                   SOCK_STREAM,
                                   sizeof(network_context_socket_tcp_t))) < 0)
        return rc;
    tcp_io_ctx = (network_context_socket_tcp_t *) net_ctx->impl_data;
    assert(tcp_io_ctx);
    tcp_io_ctx->sock_ctx = sock_ctx;
    tcp_io_ctx->new_socket = -1;
    tcp_io_ctx->connected = FALSE;
    PTHREAD_CALL(pthread_mutex_init(&tcp_io_ctx->connect_lock, NULL));
    return 0;
}
int _network_init ( mysock_context_t * sock_ctx , network_context_t * net_ctx ) { network_context_socket_tcp_t * tcp_io_ctx ; int rc ; assert ( sock_ctx && net_ctx ) ; if ( ( rc = _network_init_socket ( sock_ctx , net_ctx , SOCK_STREAM , sizeof ( network_context_socket_tcp_t ) ) ) < 0 ) return rc ; tcp_io_ctx = ( network_context_socket_tcp_t * ) net_ctx -> impl_data ; assert ( tcp_io_ctx ) ; tcp_io_ctx -> sock_ctx = sock_ctx ; tcp_io_ctx -> new_socket = -1 ; tcp_io_ctx -> connected = FALSE ; PTHREAD_CALL ( pthread_mutex_init ( & tcp_io_ctx -> connect_lock , NULL ) ) ; return 0 ; }
initialise the network subsystem.
initialise the network subsystem .