lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] NO_SYS, TCP/IP and sockets


From: Simon Goldschmidt
Subject: Re: [lwip-users] NO_SYS, TCP/IP and sockets
Date: Tue, 15 Jan 2013 15:01:42 +0100

Fabian Cenedese wrote:
> I'd like to use lwip for tcpip support in our embedded hardware.
> It uses a self written os with threads, but to keep the impact
> low I still tried first to use lwip with NO_SYS=1. I then tried
> to use sockets to access the tcp connections and found out
> that sockets and NO_SYS are mutually exclusive, in the
> examples as well as from (older) mails in this list.
> 
> Is this still the case with lwip 1.4.1? Can't sockets be used
> without system?

No. It's in the nature of BSD-alike socket APIs that they run "sequential". 
lwIP needs a dedicated thread to handle incoming packets and timers.

Once could think about changing this to let lwIP run in interrupts only and use 
sockets from the main loop only, but I that would make creating a stable lwIP 
port even harder. And I don't see what you would gain from it.

> What's the best way to use tcp without system (NO_SYS=1)?

Use the raw API, it's smaller and more performant, anyway. In most systems 
where that doesn't matter, using threads doesn't hurt.

> If I go the other road with NO_SYS=0, how many threads
> will be created?

lwIP only creates one thread. You create the other threads, so it's up to you 
how many it will be.

> I hope it's not 1 per connection as creating a thread in this os needs quite 
> some overhead.

You need an extra thread to use socket functions, but you can manage several 
socket connections from one thread when using non-blocking sockets and select() 
(as with all BSD-alike socket implementations).


Simon



reply via email to

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