![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
demo versie 16/05
Dependencies: EthernetInterface mbed-rto mbed
Fork of ProjectVLC by
TCPlistener.cpp@5:0413d42377d1, 2018-03-28 (annotated)
- Committer:
- KlaasGovaerts
- Date:
- Wed Mar 28 13:28:14 2018 +0000
- Revision:
- 5:0413d42377d1
- Child:
- 10:7871aeacea08
- Child:
- 13:f3db7045e220
Added TCPlistener class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KlaasGovaerts | 5:0413d42377d1 | 1 | #include "TCPlistener.h" |
KlaasGovaerts | 5:0413d42377d1 | 2 | |
KlaasGovaerts | 5:0413d42377d1 | 3 | TCPlistener::TCPlistener(){ |
KlaasGovaerts | 5:0413d42377d1 | 4 | char ip[]="192.168.0.253"; |
KlaasGovaerts | 5:0413d42377d1 | 5 | char mask[]="255.255.255.0"; |
KlaasGovaerts | 5:0413d42377d1 | 6 | char gateway[]="192.168.0.254"; |
KlaasGovaerts | 5:0413d42377d1 | 7 | eth.init(ip,mask,gateway); |
KlaasGovaerts | 5:0413d42377d1 | 8 | eth.connect(); |
KlaasGovaerts | 5:0413d42377d1 | 9 | server.bind(4000); |
KlaasGovaerts | 5:0413d42377d1 | 10 | } |
KlaasGovaerts | 5:0413d42377d1 | 11 | void TCPlistener::receivePacket(char *contents,int size){ |
KlaasGovaerts | 5:0413d42377d1 | 12 | int n = server.recv(contents, size); |
KlaasGovaerts | 5:0413d42377d1 | 13 | contents[n] = '\0'; |
KlaasGovaerts | 5:0413d42377d1 | 14 | printf("Segment ontvangen van %s:%i met inhoud \"%s\"\r\n", client.get_address(),client.get_port(),contents); |
KlaasGovaerts | 5:0413d42377d1 | 15 | } |