First version

Dependencies:   mbed EthernetInterface mbed-rto

Committer:
KlaasGovaerts
Date:
Tue May 15 22:17:52 2018 +0000
Revision:
76:c0c7c3f37be2
Parent:
75:31c15986b85e
Added more documentation.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
KlaasGovaerts 4:0413d42377d1 1 #include "mbed.h"
KlaasGovaerts 4:0413d42377d1 2 #include "EthernetInterface.h"
KlaasGovaerts 12:f3db7045e220 3 #include "TCPSocketServer.h"
KlaasGovaerts 12:f3db7045e220 4 #include "TCPSocketConnection.h"
KlaasGovaerts 4:0413d42377d1 5
KlaasGovaerts 4:0413d42377d1 6 #ifndef TCPLISTENER_H
KlaasGovaerts 4:0413d42377d1 7 #define TCPLISTENER_H
KlaasGovaerts 76:c0c7c3f37be2 8 /**
KlaasGovaerts 76:c0c7c3f37be2 9 * Class used to receive segments using TCP.
KlaasGovaerts 76:c0c7c3f37be2 10 */
KlaasGovaerts 4:0413d42377d1 11 class TCPlistener{
KlaasGovaerts 4:0413d42377d1 12 private:
KlaasGovaerts 4:0413d42377d1 13 EthernetInterface eth;
KlaasGovaerts 12:f3db7045e220 14 TCPSocketServer server;
KlaasGovaerts 4:0413d42377d1 15 public:
KlaasGovaerts 75:31c15986b85e 16 /**
KlaasGovaerts 75:31c15986b85e 17 * Initialise with ip address of 192.168.0.253, a mask of 255.255.255.0 and a gateway of 192.168.0.254.
KlaasGovaerts 75:31c15986b85e 18 * Starts a TCP server which will listen on port 4000.
KlaasGovaerts 75:31c15986b85e 19 */
KlaasGovaerts 62:0b634db67ca8 20 TCPlistener();
KlaasGovaerts 75:31c15986b85e 21
KlaasGovaerts 75:31c15986b85e 22 /**
KlaasGovaerts 75:31c15986b85e 23 * Receives all packets sent to 192.168.0.253:4000.
KlaasGovaerts 75:31c15986b85e 24 * @param contents The location where the segment contents will be written, formatted as null terminated character array.
KlaasGovaerts 75:31c15986b85e 25 * @param size The max size of the "contents" array.
KlaasGovaerts 75:31c15986b85e 26 * @return True if a segment was received, false if no segment was received.
KlaasGovaerts 75:31c15986b85e 27 */
KlaasGovaerts 15:ffd311730575 28 bool receiveSegment(char *contents,int size);
KlaasGovaerts 4:0413d42377d1 29 };
KlaasGovaerts 4:0413d42377d1 30 #endif