lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] netconn_write always returning always ERR_OK


From: Fabien Blanchet
Subject: [lwip-users] netconn_write always returning always ERR_OK
Date: Wed, 19 Sep 2012 13:58:37 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]