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
HTTP_SERVER.h
- Committer:
- aktk
- Date:
- 2018-03-19
- Revision:
- 16:c3920b5b8572
- Parent:
- 15:9b2cfbaf1c12
- Child:
- 17:ce5845164001
File content as of revision 16:c3920b5b8572:
//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, }; /** HttpServer class * * This is the class to make a mbed a simple HTTP Server. */ class HttpServer { public: HttpServer(); ~HttpServer(); /** HTTP SERVER Initialization. * * This function should be called first of all. * @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 NetworkInterface *net; // Eternet/Wifi TCPSocket client_socket; // TCP server connection clerk SocketAddress client_address; // Address of client TCPServer server; // TCP server ResponseMessenger msger; // Handler of Messenge for a client FileHandler fhndl; // File Handler // Param //bool keep_alive; bool listening_flag; bool socket_connection; uint16_t port; //Port number int backlog; //backlog Number of pending connections that can be queued simultaneously // Function bool analyzeRequest(char*,int,char*&,char*&,char*&); bool sendResponse(char*,char*,char*); }; #endif