Unable to connect to device after wiced_tcp_accept returned an error

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I'm using SDK 3.5.2, ThreadX/NetX_Duo, and I run a TCP server on my device. Sometime when an incoming connexion arrives, accept won't work, and then I can't even get to the connect event callback.

I run the following code in a worker thread (triggered by the connect callback):

static wiced_result_t

eci_connect_process (void *user_data)

{

    wiced_tcp_socket_t *sock = user_data;

    unsigned char *addr = (unsigned char *) &sock->socket.nx_tcp_socket_connect_ip.nxd_ip_address.v4;

    LOG_PRINT (LOG_DEBUG, "[eci] Accepting new connection from %u.%u.%u.%u on %d\n",

               addr[3], addr[2], addr[1], addr[0], sock->socket.nx_tcp_socket_connect_port);

    wiced_result_t r = wiced_tcp_server_accept (&eci_server, sock);

    if (r != WICED_SUCCESS)

        LOG_PRINT (LOG_ERROR, "[eci] accept failed\n");

    return r;

}

And I get the following output:

LOG_DEBUG: [eci] Accepting new connection from 192.168.1.34 on 59211

Error accepting connection 2 (38)

LOG_ERROR: [eci] accept failed

I'm a bit confused because nx_tcp_server_socket_accept is not supposed to return 0x38 (NX_NOT_CONNECTED), or at least not from the NetX documentation I have from the SDK.

Did someone encounter the same issue ? Is there anyway to fix this (different that rebooting) ?

10 Replies