Example program for the BSDInterface
Dependencies: BSDInterface NetworkSocketAPI
Fork of HelloLWIPInterface by
Diff: main.cpp
- Revision:
- 49:e1689f3f04f3
- Parent:
- 47:ac3cc44106cb
- Child:
- 50:6566cd992ac6
--- a/main.cpp Sat Feb 27 20:12:12 2016 -0600 +++ b/main.cpp Sat Feb 27 21:03:02 2016 -0600 @@ -16,9 +16,7 @@ #include "BSDInterface.h" #include "TCPSocket.h" - -DigitalOut myled(LED_GREEN); -void flash(){ myled = !myled; } +#include <stdio.h> BSDInterface iface; TCPSocket socket(&iface); @@ -27,8 +25,6 @@ { printf("NetworkSocketAPI Example\r\n"); - iface.connect(); - const char *ip = iface.getIPAddress(); const char *mac = iface.getMACAddress(); printf("IP Address is: %s\r\n", (ip) ? ip : "No IP"); @@ -42,9 +38,8 @@ size = socket.recv(recieved, sizeof(recieved)); socket.close(); - iface.disconnect(); - printf("Recieved: %ld bytes, %02x%02x%02x%02x\r\n", size, + printf("Recieved: %d bytes, %02x%02x%02x%02x\r\n", size, recieved[0], recieved[1], recieved[2], recieved[3]); printf("NetworkSocketAPI Example Finished\r\n"); }