lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Incoming packets not seen by lwip_select on second accept


From: Ian Wilson
Subject: [lwip-users] Incoming packets not seen by lwip_select on second accept
Date: Wed, 18 Jan 2012 17:42:12 +1100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Hello all,

I can provide more details than this (incl. lwip debgs and wireshark logs) but I wanted to find out first if there is something obvious before imposing on people to parse my detailed data. I have tried to search for relevant Q&A's but with no success.

I have a lwip based system running on a soft-core processor. The stack is based on LwIP v1.4.0 RC1 I believe.

I am using sockets and POSIX threads.

A thread (socketListenerThread) binds to and listens for connections on a high-numbered TCP port. When a connection comes, it is accepted (lwip_accept) in a new thread (the socketHandlerThread) is created and the accepted socket passed in via the thread creation argument. The handler thread casts this arg appropriately to an int socket descriptor. lwip_select, with a one second timeout, is used in a loop to wait for incoming packets. On timeout, various high lever timeout and status values are checked to see if thread termination is needed, otherwise lwip_select is called again. When the handler thread exits it closes the accepted socket.

If a new connection request comes in while the handler thread is running, the new connection is refused. Only one connection at a time is allowed at this stage. (This may change in the future.) Speed and throughput are not huge issues (now at least) so I am not too worried about static thread pools etc.

This all works for the first connection. The problem is that incoming packets are not "detected" by lwip_select for subsequent connections to the listener (after closing the first connection of course).

I can't see a difference between the two connections and packet flow in wireshark or in lwip debugs - apart from there being no response from my high level code to the incoming packets on the second and later connections. Lwip debugs show that something is being received by the lwip stack, but it doesn't then seem to get all the way up to trigger lwip_select.

Is this something obvious? If not I will provide some code and wireshark and lwip debug logs.

Any suggestions on the best lwip debug settings that would help detect where the problem is?

Sorry for imposing,
Ian






reply via email to

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