You are viewing an older revision! See the latest version

Networking

Library

Import Library:

http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk

or import precompiled Library:

http://mbed.org/projects/cookbook/svn/EMAC/lwip/precomp

Import Example program:

http://mbed.org/projects/cookbook/svn/EMAC/lwip/examples/HTTPServer

Hardware

To use this Library you have to connect the Ethernet pins of your mbed board with a Network. I have used a MagJack SI-60002-F to provide a RJ45 Jack.

            |   |   |   |         
          --||--||--||--||-----   Socket mbed
        /  8 | 6 | 4 | 2 |    /|       1 RD+
       /    7   5   3   1    / |       2 
      /                     /  |       3 RD-
     /    Bel Stewart      /   |       4 TD-
    /      MagJack        /    |       5
   /     SI-60002-F      /     |       6 TD+
  /___________________  /      |                                                               
 |      --------       |       |                                                               
 |    --        --     |       |                                                               
 | --- |          ---- |      /                                                                
 ||    /--/-/-/-/-/-/-||     /                                 ___                   ________   
 ||   /  8 7 6 5 4 3 2||    /              ________________  -/   \-        ____    |   ____ |  
 ||  /  / / / / / / / ||   /      ,= ,++, /,  ,  ,  ,  ,  ,\|,  ,  ,| ,  , /,  ,| , |,  ,  ,_|  
 || /  / / / / / / / /||  /      ============================================================  
 ||/  ' ' ' ' ' ' ' ' || /        |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |    
 | ------------------- |/         |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |    
  ---------------------                                               ^  ^  ^  ^                
  Ethernet Socket Front           mbed Board                         TD+TD-RD+RD-               

Internal wiring

HTTP Server

A very easy to use HTTP Server which will server files from the flashdrive. The default file is called "index.htm".

Furthermore it can serve rpc requests when you request a page starting with /rpc. For example: "http://mbed-ip-or-hostname/rpc/led1/write+1"

For the rpc path you can use rather , or + or = or in a modern browser space which will be converted to %20.

By default the server uses DHCP to connect to the network and will print out it's IP address to stdout (by default USB serial).

API

Resources

HTTP Client

  • HTTP Client - The HTTPClient class.
  • Twitter - A simple demo how to use the HTTPClient class with twitter
  • Timetric - A simple demo how to use the HTTPClient class with timetric

lwIP internal examples

External resources


All wikipages