Chris Styles
/
HelloServerDemo
Diff: main.cpp
- Revision:
- 0:a87ea5d8da61
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 21 12:08:04 2009 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#include "HTTPServer.h" +#include "HTTPStaticPage.h" + +#include <string.h> + +const char content[] = "<HTML><BODY><H1>Hello World</H1></BODY></HTML>"; + +HTTPServer http; + +int main(void) { + http.addHandler(new HTTPStaticPage("/index.htm", content, strlen(content))); + http.bind(); + NetServer *net = NetServer::get(); + 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); + while(1) { + http.poll(); + } +} \ No newline at end of file