Nathan Argetsinger
/
aaa_UDP_pixel_server
example make build
Fork of TCPSocket_Example by
Diff: main.cpp
- Revision:
- 4:7a0bcf58a8a3
- Parent:
- 3:70182dad8745
--- a/main.cpp Fri Jul 14 16:21:07 2017 +0000 +++ b/main.cpp Fri Jul 14 19:04:43 2017 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" #include "EthernetInterface.h" -#include <UDPSocket.h> +//#include <UDPSocket.h> #define LED_NUM 23 #define LED_GLOBAL 4 // brightness 0-31 @@ -100,7 +100,7 @@ // socket.connect("10.200.1.20", 4242); // net params - const char* host = "10.200.1.20"; + const char* host = "10.200.1.123"; uint16_t port = 4242; @@ -112,7 +112,7 @@ // Send a simple http request char sbuffer[] = "GET / HTTP/1.1\r\nHost: www.arm.com\r\n\r\n"; // int scount = socket.send(sbuffer, sizeof sbuffer); - int scount = socket.sendto("10.200.1.20", 4242, sbuffer, sizeof sbuffer); + int scount = socket.sendto(host, port, sbuffer, sizeof sbuffer); printf("sent %d [%.*s]\n", scount, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); // Recieve a simple http response and print out the response line @@ -151,6 +151,9 @@ break; } } + + + // Close the socket to return its memory and bring down the network interface socket.close();