HelloServerDemo
Published 21 Sep 2009, by
Chris Styles

No tags
« Back to documentation index
Show/hide line numbers
main.cpp Source File
main.cpp
00001 #include "mbed.h"
00002 #include "HTTPServer.h"
00003 #include "HTTPStaticPage.h"
00004
00005 #include <string.h>
00006
00007 const char content[] = "<HTML><BODY><H1>Hello World</H1></BODY></HTML>";
00008
00009 HTTPServer http;
00010
00011 int main(void) {
00012 http.addHandler(new HTTPStaticPage("/index.htm", content, strlen(content)));
00013 http.bind();
00014 NetServer *net = NetServer::get();
00015 printf("%hhu.%hhu.%hhu.%hhu\n", (net->getIPAddr().addr)&0xFF, (net->getIPAddr().addr>>8)&0xFF, (net->getIPAddr().addr>>16)&0xFF, (net->getIPAddr().addr>>24)&0xFF);
00016 while(1) {
00017 http.poll();
00018 }
00019 }