lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] netconn Client


From: Sachs, Nico
Subject: [lwip-users] netconn Client
Date: Fri, 30 Apr 2021 15:39:07 +0000

Hi,

 

is there anywhere a reference implementation of a TCP Client with Netconn?

 

I think I’m doing something wrong with the lifecycle of my “struct netconn *conn".

 

In particular: If the Server closes the connection to my client, I’ve got an NETCONN_EVT_ERROR through the netconn event callback.

Then in my thread I do:

 

netconn_close(conn);

netconn_delete(conn);

 

and set my statemachine state to “tryconnect” in which I start with:

 

if(conn)

            {

                        netconn_close(conn);

                        netconn_delete(conn);

            }

 

And create a new netconn and try to connect again:

 

conn = netconn_new_with_callback(NETCONN_TCP, comEvent_netconn_cb);

            netconn_bind(conn, IP_ADDR_ANY, 0);

            netconn_set_nonblocking(conn, 0);

            LWIP_ERROR("comEvent: invalid conn", (conn != NULL), return;);

            err = netconn_connect(conn, &remoteip, TCPPORT);

 

 

“conn” still exists when I enter tryconnect state. and there it tries to close and delete it again, while netconn_delete throws an assert saying:

Assertion “netconn state error” failed at line 1119 in ../LwIP/src/api/api_msg.c

 

Connàstate is here always 135 which should not exist, therefore garbage.

I’m not using MEMP_MEM_MALLOC

Should  I just reuse existing netconn and create it once at startup?

 

Appreciate somebody’s help.

 

Cheers

 


reply via email to

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