[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] how to cancel a netconn conncetion?
From: |
Bertrand Van Kempen |
Subject: |
[lwip-users] how to cancel a netconn conncetion? |
Date: |
Mon, 9 Nov 2009 11:06:11 +0100 |
Hello,
I'm using the netconn API to implement a HTTP server.
All works fine but I don't found how to cancel the "netconn listening" to exit
properly in my application.
I tried to call netconn_close and netconn_delete but the working thread still
wait on netconn_accept(m_pConn);
Thanks in advance for your help,
Bertrand van Kempen
I do the following:
I initialize an TCP connection from the main thread:
m_pConn = netconn_new(NETCONN_TCP);
netconn_bind(m_pConn, IP_ADDR_ANY, 80)
netconn_listen(m_pConn);
and, from another thread I call the following in a loop:
while(m_bContinue)
{
struct netconn *newconn;
MTAL_DP("{");
newconn = netconn_accept(m_pConn);
if(newconn){
http_server_serve(newconn);
netconn_delete(newconn);
}
}
Then, I tried to do the following form the main thread:
m_bThreadContinue = false;
if(m_pConn)
{
netconn_close(m_pConn);
netconn_delete(m_pConn);
m_pConn = NULL;
}
- [lwip-users] how to cancel a netconn conncetion?,
Bertrand Van Kempen <=