Example program for the BSDInterface
Dependencies: BSDInterface NetworkSocketAPI
Fork of HelloLWIPInterface by
Diff: main.cpp
- Revision:
- 50:6566cd992ac6
- Parent:
- 49:e1689f3f04f3
diff -r e1689f3f04f3 -r 6566cd992ac6 main.cpp --- a/main.cpp Sat Feb 27 21:03:02 2016 -0600 +++ b/main.cpp Sun Feb 28 11:27:32 2016 -0600 @@ -19,7 +19,7 @@ #include <stdio.h> BSDInterface iface; -TCPSocket socket(&iface); +TCPSocket sock(&iface); int main() { @@ -30,14 +30,14 @@ printf("IP Address is: %s\r\n", (ip) ? ip : "No IP"); printf("MAC Address is: %s\r\n", (mac) ? mac : "No MAC"); - socket.open("time-a.nist.gov", 37); - printf("time-a.nist.gov resolved to: %s\r\n", socket.getIPAddress()); + sock.open("time-a.nist.gov", 37); + printf("time-a.nist.gov resolved to: %s\r\n", sock.getIPAddress()); - char recieved[100] = {0}; + unsigned char recieved[100] = {0}; int32_t size = 0; - size = socket.recv(recieved, sizeof(recieved)); + size = sock.recv(recieved, sizeof(recieved)); - socket.close(); + sock.close(); printf("Recieved: %d bytes, %02x%02x%02x%02x\r\n", size, recieved[0], recieved[1], recieved[2], recieved[3]);