First version
Dependencies: mbed EthernetInterface mbed-rto
TCPlistener.h@75:31c15986b85e, 2018-05-15 (annotated)
- Committer:
- KlaasGovaerts
- Date:
- Tue May 15 21:44:25 2018 +0000
- Revision:
- 75:31c15986b85e
- Parent:
- 62:0b634db67ca8
- Child:
- 76:c0c7c3f37be2
Added documentation.
Who changed what in which revision?
User | Revision | Line number | New 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 | 4:0413d42377d1 | 8 | class TCPlistener{ |
KlaasGovaerts | 4:0413d42377d1 | 9 | private: |
KlaasGovaerts | 4:0413d42377d1 | 10 | EthernetInterface eth; |
KlaasGovaerts | 12:f3db7045e220 | 11 | TCPSocketServer server; |
KlaasGovaerts | 4:0413d42377d1 | 12 | public: |
KlaasGovaerts | 75:31c15986b85e | 13 | /** |
KlaasGovaerts | 75:31c15986b85e | 14 | * 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 | 15 | * Starts a TCP server which will listen on port 4000. |
KlaasGovaerts | 75:31c15986b85e | 16 | */ |
KlaasGovaerts | 62:0b634db67ca8 | 17 | TCPlistener(); |
KlaasGovaerts | 75:31c15986b85e | 18 | |
KlaasGovaerts | 75:31c15986b85e | 19 | /** |
KlaasGovaerts | 75:31c15986b85e | 20 | * Receives all packets sent to 192.168.0.253:4000. |
KlaasGovaerts | 75:31c15986b85e | 21 | * @param contents The location where the segment contents will be written, formatted as null terminated character array. |
KlaasGovaerts | 75:31c15986b85e | 22 | * @param size The max size of the "contents" array. |
KlaasGovaerts | 75:31c15986b85e | 23 | * @return True if a segment was received, false if no segment was received. |
KlaasGovaerts | 75:31c15986b85e | 24 | */ |
KlaasGovaerts | 15:ffd311730575 | 25 | bool receiveSegment(char *contents,int size); |
KlaasGovaerts | 4:0413d42377d1 | 26 | }; |
KlaasGovaerts | 4:0413d42377d1 | 27 | #endif |