[Top][All Lists]

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

[lwip-users] Handle multiple connections using netconn API?

From: Grant Edwards
Subject: [lwip-users] Handle multiple connections using netconn API?
Date: Fri, 19 Nov 2021 16:38:46 -0000 (UTC)
User-agent: slrn/1.0.3 (Linux)

For the past few days, I've been trying to figure out the netconn API
equivalent for select/poll, and I haven't been able to come up with

How does a single server thread handle multiple TCP or UDP
"connections" using the netconn API?

If you use a callback to wake the server thread, how do you avoid a
race condition when data arrives just after it has serviced all the
connections but before the server thread blocks?

Handling the recv data in the callback seems like a bad idea, since
that presumably is done in the tcpip thread's context. Handling the
recv data may take a considerable amount of time and needs to be done
at a low priority so that it doesn't interfere with other
time-critical traffic.

Isn't there some way to handle this without switching to the socket

One answer is to create a server thread for each new connection, and
then use blocking recv calls. But, that's not possible in my RTOS:
threads can't be created dynamically. They have to be declared
statically at compile time. [Yes, that's a pain.]

In my system sys_thread_new() doesn't actually "create" a thread. It
searches the static table of threads and starts the thread with a
matching entry point.



reply via email to

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