For lecture
Dependencies: WIZnetInterface mbed WIZwiki-W7500-lecture
Dependents: WIZwiki-W7500-lecture1-tcp WIZwiki-W7500-lecture2-udp WIZwiki-W7500-lecture WIZwiki-W7500-lecture1-tcp-server ... more
Fork of TCPClient_HelloWorld_WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 3:6bf1bacd14f5
- Parent:
- 2:ba228e5b659c
- Child:
- 4:09dc56cf66d3
--- a/main.cpp Mon Feb 01 00:34:33 2016 +0000 +++ b/main.cpp Mon Feb 01 01:22:38 2016 +0000 @@ -9,30 +9,4 @@ eth.init(mac_addr, "192.168.0.180", "255.255.255.0", "192.168.0.1"); // USE Static IP //eth.init(mac_addr); //Use DHCP eth.connect(); - - printf("IP Address is %s\r\n", eth.getIPAddress()); - - UDPSocket udp_sock; - TCPSocketConnection tcp_sock; - tcp_sock.connect("192.168.0.244", 4545); - udp_sock.init(); - udp_sock.bind(60001); - Endpoint udp_server; - udp_server.set_address("192.168.0.244",4023); - char http_cmd[] = "GET /data/2.5/weather?q=Seoul,kr HTTP/1.0\n\n"; - tcp_sock.send_all(http_cmd, sizeof(http_cmd)-1); - udp_sock.sendTo(udp_server,http_cmd,sizeof(http_cmd)-1); - char buffer[400]; - int ret; - while (true) { - ret = tcp_sock.receive(buffer, sizeof(buffer)-1); - if (ret <= 0) break; - buffer[ret] = '\0'; - printf("Received %d chars from server: %s\n", ret, buffer); - } - - tcp_sock.close(); - - eth.disconnect(); - } \ No newline at end of file