lwIP HTTPClient/HTTPServer

I've ported over the lwIP TCP/IP stack to mbed to provide an HTTPClient and HTTPServer. There is no RTOS on the mbed target available so it has to run in the same thread of execution as the application therefore it uses a poll based model. To leave more RAM to the application it shares the network RAM space with the lowlevel driver (ETH RAM on LPC2368, AHBSRAM1 on LPC1768).

It uses the mbed Ethernet class as a back end driver. To use just the Ethernet class have a look _ _here. This is most of enough if you just want to send a UDP packet or broadcast big chunks of data into a network.


Import Library:


or import precompiled Library:



Ethernet plug

To use it you need to connect your Ethernet correctly. How to do it you may find out at my Ethernet page.



The HTTPClient class provides an easy interface to HTTP GET/POST. You can download files from HTTP servers or update data on your HTTP server.

At the current state it allows the download in normal mode, chunk mode is not denied but the chunks are not recognized. Furthermore the size of the page is currently not detected right, you might get garbage at the end.

A Twitter Hello World

#include "mbed.h"
#include "HTTPClient.h"

DigitalOut led(LED1);
HTTPClient http;
const char user[] = "[your twitter username]";
const char pass[] = "[your twitter password]";
const char msg[] = "status=Hello World from an mbed";
const char url[]  = "http://twitter.com/statuses/update.xml";

int main(void) {
    http.auth(user, pass);
    http.post(url, msg);

    while(1) {
        led = !led;



The HTTPServer class provides an HTTP server for your mbed. You can go to your mbed with your Web browser and access the file system or ask some sensor values.


Development Log

  • I observed that the HTTPClient does sometimes not receive a TCP packet. Seems like a problem inside of lwip.
  • lwip seems not to handle out of order packages very well.
  • The lwip stack tries sometimes to reestablish a connection after a page was successfully delivered.


Useful tools to debug are:


For more information have a look at these pages:
HomepageSavannahWiki )


20 Nov 2009

Where can one find this library please :)

06 Apr 2010

Hi Rolf

HTTPClient ... At the current state it allows the download in normal mode, chunk mode is not denied but the chunks are not recognized.

Since chunks are not recognized, can you provide the option to use a HTTP/1.0 GET request rather than HTTP/1.1? In this way, the server will not use transfer encoding so avoiding chunks altogether.


26 Mar 2013

Http client i have mastered but getting POST data onto the httpserver usint IwIP is just killing the fun at the moment.

I've tried using examples to understand how it's working but to no success so far. My major grief s the fact theres no error logging on the httpserver side from what i can find. Normally in an apache server env you've got the http error logs to fall back on when you've been an iddiot and forgotten some syntax etc.

All i want to do is send a post form to divide up the data and squirt it to a few devices and send back a reply.

Or is it easier to just send xml and get a reply?

any assistance would be greatly appreciated.


07 Mar 2014

All of the links can not be opened.


You need to log in to post a comment