
TCP-client with round robin communication -> Added extra function to select address of client with joystick
Diff: main.cpp
- Revision:
- 0:1a75d762a447
- Child:
- 1:61982a2230eb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Mar 07 19:29:08 2020 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "EthernetInterface.h" + + +DigitalOut led(LED1); + +int main() +{ + printf("Client example\n\r"); + + EthernetInterface eth; + eth.set_network("192.168.0.39","255.255.255.0","192.168.0.1"); + eth.connect(); + + printf("The client IP address is '%s'\n\r", eth.get_ip_address()); + + + + + TCPSocket socket; + + socket.open(ð); + socket.connect("192.168.0.40",4000); + + char rbuffer[64]; + int rcount = socket.recv(rbuffer, sizeof rbuffer); + printf("received: %d\r\n", rcount); + printf(rbuffer); + + socket.close(); + +} + +