Rob Toulson / Mbed 2 deprecated PE_12-10_FileServerSetup

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* Program Example: 12.10 mbed file server setup
00002                                                            */
00003 #include "mbed.h"
00004 #include "EthernetNetIf.h"
00005 #include "HTTPServer.h"
00006 LocalFileSystem fs("webfs");
00007 EthernetNetIf eth(
00008   IpAddr(192,168,0,101),      //IP Address
00009   IpAddr(255,255,255,0),      //Network Mask
00010   IpAddr(192,168,0,1),        //Gateway
00011   IpAddr(192,168,0,1)         //DNS
00012 );
00013 HTTPServer svr;
00014 int main() {
00015   eth.setup();
00016   FSHandler::mount("/webfs", "/");    //Mount webfs path on root path
00017   svr.addHandler<FSHandler>("/");     //Default handler
00018   svr.bind(80);
00019   while(1)
00020   {
00021     Net::poll();                  // poll for internet data exchange requests
00022   }
00023 }
00024