Udp socket sample program. This program will send back the received packet.
Dependencies: NyFileSystems libMiMic mbed-rtos mbed
main.cpp
- Committer:
- nyatla
- Date:
- 2013-04-09
- Revision:
- 4:0a280ed0a848
- Parent:
- 3:77431c2bd9cb
- Child:
- 5:6a2a1644ea2c
File content as of revision 4:0a280ed0a848:
/** * @file * This is ModLocalFileSystem sample program. * * <pre> * 1. Compile this program and write to your mbed. * 2. Write files for testing to mbed disk. * 2. Access via web browser to http://192.168.0.39/local/<filename> * 3. You can see <filename> file on browser. * </pre> */ #include "mimic.h" /** * local filesystem support. */ LocalFileSystem lf("local"); /** * MiMic RemoteMCU httpd.<br/> * <p>Service list</p> * <pre> * /local/ - mbed LocalFileSystem * </pre> */ class LfsHttpd:public MiMic::Httpd { private: ModLocalFileSystem modurl; //basic URL parser public: LfsHttpd():Httpd(80) { //bind local file system path to /local/* modurl.setParam("local"); } virtual void onRequest(HttpdConnection& i_connection) { //call ModUrl module. if(!this->modurl.execute(i_connection)){ //send 430 i_connection.sendHeader(403,"text/html",NULL); i_connection.sendBodyF("<html><body>403 Forbidden</body></html>"); return; } return; } }; int main() { NetConfig cfg; //create network configulation Net net(cfg); //create a net instance. LfsHttpd httpd; //create a httpd instance. httpd.loop(); //start httpd loop. return 0; }