Arthur Coupe
/
tcp-client
.
main.cpp
- Committer:
- pcordemans
- Date:
- 2020-03-07
- Revision:
- 0:1a75d762a447
- Child:
- 1:02023a9fd316
File content as of revision 0:1a75d762a447:
#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(); }