Hi all,

I am writing my first lwIP (1.3.2) project using an RTOS and I face an issue. My software connect my board to an TCP server and send TCP data using netconn_write. It's working fine (connection and write) during 10-20 seconds but after data are not send at all and netconn_write return ERR_OK. I also tried to disconnect the ethernet cable when this issue appears to see if any error will be returned, but I still have netconn_write returning ERR_OK.

I think I do something wrong, so I would like to have some help from you.

Please find the code of my software:
struct netconn *TxConn = NULL;
char ClientConnected = FALSE;

for( ;; )
{
    while (ClientConnected == FALSE)
    {
        /* Create a new connection identifier. */
        TxConn = netconn_new(NETCONN_TCP);

        /* Try to connect with the TCP server */
        if (netconn_connect(TxConn, &ipaddr_server, 10113) == ERR_OK)
            ClientConnected = TRUE;
        else
        {
            /* Close & Delete the Connection before trying again */
            netconn_close(TxConn);
            netconn_delete(TxConn);
        }

    }

    /* Send data over TCP to server */
if ((netconn_write(TxConn, QueueTCPClientData.Data, QueueTCPClientData.Size, NETCONN_NOCOPY)) == ERR_OK)
    {
        /* Always enter here even if Ethernet cable is disconnected */
    }
    else
    {
        /* Close & Delete the Connection before trying again */
        netconn_close(TxConn);
        netconn_delete(TxConn);
        /* Set Flag to Flase to connect again */
        ClientConnected = FALSE;
    }
}

Thanks in advance for your help
Best Regards
Fabien


_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to