LwIP – Lightweight IP Stack

fidotron | 183 points

IP Stack is a bit of an understatement. It comes with enough to be a HTTP client, a HTTP server or a MQTT client - and that is the way I've seen it used in practice.

It is more like the busybox of embedded networking, but with a much more convenient license.

weinzierl | 11 days ago

We used LwIP for a project some years ago, and found a very nice way to do system testing.

The project involved multiple microcontrollers communicating over an internal LAN. They used a small embedded kernel named MicroCOS, with LwIP as the IP stack.

We had cross-platform build tools set up, so we could build our stand-alone microprocessor applications either for native execution or with gcc, compiling to x64 code and executable on developer boxes. In the latter case, we implemented the lowest level link-layer part of LwIP using a mock, that used standard TCP/IP! We wrote a small TCP server and would spool up the micro-controller applications, which would then talk to each other on the developer machines as though they were running inside the actual system.

This setup worked really well, and we used it for years during the development effort for the project.

gregfjohnson | 10 days ago

For those looking for options like LwIP, consider NetXDuo [1] and its counterparts ThreadX, FileX, LevelX, and UsbX (I use TinyUSB instead).

It has been one of the top commercial RTOS network stacks for, I think, 20 years. It moved hands a couple of times and now is supported by the Eclipse Foundation and is MIT-licensed. I'd use it over LwIP.

[1] https://github.com/eclipse-threadx/netxduo

bangaladore | 10 days ago

Adam Dunkels also wrote (most of) Protothreads. https://dunkels.com/adam/pt/

jacobmarble | 11 days ago

What is nongnu.org and how does it relate to gnu.org?

EDIT: I found an answer[0].

  StevePerkins on May 22, 2016 | unvote | next [–]

  http://savannah.gnu.org is a hosting site for "official" GNU software (i.e. sponsored by the Free Software Foundation).

  http://savannah.nongnu.org is a hosting site for "community" projects that are not sponsored by the FSF.
[0] https://news.ycombinator.com/item?id=11747093
evanjrowley | 10 days ago

I guess it's the most used TCP/IP stack in resource constrained devices. But it seemed that for long, there's no competent alternative to it. https://github.com/FreeRTOS/FreeRTOS-Plus-TCP looks like a promising one.

kneep | 11 days ago

I really like LWIP because it lets you use the same block of memory allocated by the Ethernet MAC DMA for the lifetime of the packet. You can really optimize the memory “pools” for your use case to reduce the number of memcpys.

quailfarmer | 11 days ago

For those folks interested in implementing their own lightweight TCP/IP stack, Jeremy Bentham's book; TCP/IP Lean is a great resource.

rramadass | 10 days ago

From the article:

"This making lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM."

tony-allan | 11 days ago

Similarly, for Go programmers: https://pkg.go.dev/inet.af/netstack

tptacek | 11 days ago

I love these tiny TCP stacks.

I used to work with TinyTCP back when. What's interesting is if a search for tinytcp turns up a bunch of them. Awesome!

Apparently there's no tiny ipv6 stack?

mannyv | 11 days ago

I first heard about LwIP when I worked with the ESP32. Espressiv seems to maintain its own fork with some ESP-specific patches: https://github.com/espressif/esp-lwip

spacechild1 | 10 days ago

see also uip and contiki as well as the other creations from Mr. Dunkles:

https://dunkels.com/adam/software.html

throwawayabcdef | 11 days ago

What is nongnu.org, and what is its relationship to gnu.org?

stevefolta | 11 days ago

How does LwIP compare to SmolTCP at this point?

bfrog | 10 days ago

[flagged]

bloco1 | 10 days ago

[flagged]

taspeotis | 11 days ago

What’s the news value of this? LWIP is the most popular embedded network stack and has been around for ages. It also is awful to use and riddled with undocumented issues (in my experience, anyway)

lovidico | 11 days ago