![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
TCPlistener.h
- Committer:
- KlaasGovaerts
- Date:
- 2018-05-15
- Revision:
- 76:c0c7c3f37be2
- Parent:
- 75:31c15986b85e
File content as of revision 76:c0c7c3f37be2:
#include "mbed.h" #include "EthernetInterface.h" #include "TCPSocketServer.h" #include "TCPSocketConnection.h" #ifndef TCPLISTENER_H #define TCPLISTENER_H /** * Class used to receive segments using TCP. */ class TCPlistener{ private: EthernetInterface eth; TCPSocketServer server; public: /** * Initialise with ip address of 192.168.0.253, a mask of 255.255.255.0 and a gateway of 192.168.0.254. * Starts a TCP server which will listen on port 4000. */ TCPlistener(); /** * Receives all packets sent to 192.168.0.253:4000. * @param contents The location where the segment contents will be written, formatted as null terminated character array. * @param size The max size of the "contents" array. * @return True if a segment was received, false if no segment was received. */ bool receiveSegment(char *contents,int size); }; #endif