Machine Vision Status TCP Server
Dependencies: C12832 EthernetInterface mbed-rtos mbed ConfigFile
TcpDaemon.h
- Committer:
- dwini
- Date:
- 2015-03-05
- Revision:
- 1:8efef658d90b
- Child:
- 2:a8eebf64cd3e
File content as of revision 1:8efef658d90b:
#include "EthernetInterface.h" #ifndef TCP_DAEMON_HEADER #define TCP_DAEMON_HEADER #define MAX_BACKLOG 1 namespace MachineVision{ class TcpDaemon{ public: const static int BUFFER_SIZE = 512; const static int TCP_TIMEOUT = 1000; private: int server_port; TCPSocketServer server; TCPSocketConnection client; char buffer[BUFFER_SIZE+1]; bool keepListening; public: /* * TcpDaemon constructor * * @server_port the port the daemon will be listening on */ TcpDaemon(int server_port); /* * Make the daemon start listening for incoming connections */ void startListening(); private: /* * Bind to server socket * * @return true on success */ bool bindSocket(); /* * Listen for incoming connections */ void doListen(); }; } #endif