The lib with which to make LPC1768 a simple HTTP server. This have not yet implemented. fopen() DOESN'T WORK after EthernetInterface::connect() is called as using mbed-os 5.4~. See also https://os.mbed.com/questions/80658/HardFault-occurs-when-fopen-is-called-af/ or https://github.com/ARMmbed/mbed-os/issues/6578 and https://github.com/ARMmbed/mbed-os/issues/6624
Fork of HTTP_SERVER by
Diff: HTTP_SERVER.h
- Revision:
- 0:cc483bea4fe3
- Child:
- 9:84aca9965f9f
diff -r 000000000000 -r cc483bea4fe3 HTTP_SERVER.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTP_SERVER.h Tue Feb 16 10:59:31 2016 +0000 @@ -0,0 +1,51 @@ +//HTTP_SERVER.h +#ifndef HTTP_SERVER_H +#define HTTP_SERVER_H +#include "mbed.h" +#include "EthernetInterface.h" +#include "ResponseMessenger.h" +#include "FileHandler.h" +#include "string.h" +#include <stdlib.h> +using namespace std; + +enum PortNum { + TCP_PORT = 80 +}; + +class HttpServer +{ +public: + HttpServer(); + ~HttpServer(); + /** + * HTTP SERVER Initialization. + * This is called in the Constructor. + * You don't have to use but can call this if you have some reasons to init the server. + * @return result of init() as boolean. + * @retval TRUE SACCESS + * @retval FALSE + */ + bool init(); + /** + * Run the surver service while listening flag is true. + * @return state ending. + * @retval TRUE at error end. + * @retval FALSE at normal end. + */ + bool run(); + +private: + // Handlers + EthernetInterface eth; // Eternet + TCPSocketServer tcpsvr; // TCP server + TCPSocketConnection tcpcon; // TCP server connection clerk + ResponseMessenger msger; // Messenger for a client + FileHandler fhandl; // + // Param + bool keep_alive; + bool listening_flag; + char* req_buf[1024]; +}; + +#endif \ No newline at end of file