Example program for the BSDInterface

Dependencies:   BSDInterface NetworkSocketAPI

Fork of HelloLWIPInterface by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Wed Jun 17 23:38:33 2015 +0000
Parent:
8:cb6e31861ac9
Child:
10:ca389819e01e
Commit message:
update example program adding sockets access

Changed in this revision

NetworkSocketAPI.lib Show annotated file Show diff for this revision Revisions of this file
WiFiRadioInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NetworkSocketAPI.lib	Wed Jun 17 21:04:47 2015 +0000
+++ b/NetworkSocketAPI.lib	Wed Jun 17 23:38:33 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#b147c08301be
+http://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#4b7f97a5597b
--- a/WiFiRadioInterface.lib	Wed Jun 17 21:04:47 2015 +0000
+++ b/WiFiRadioInterface.lib	Wed Jun 17 23:38:33 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/wifi_interface/#8db9b116cf76
+http://developer.mbed.org/teams/NetworkSocketAPI/code/wifi_interface/#0186e9e35a24
--- a/main.cpp	Wed Jun 17 21:04:47 2015 +0000
+++ b/main.cpp	Wed Jun 17 23:38:33 2015 +0000
@@ -44,6 +44,18 @@
     printf("Gateway: %s\n", wifi.getGateway());
     printf("Mask: %s\n", wifi.getNetworkMask());
     printf("MAC: %s\n", wifi.getMACAddress());
+    
+    //Endpoint google;
+    wifi.set_address(wifi.get_host_by_name("www.google.com"));
+    wifi.set_address("216.58.192.46");
+    wifi.set_port(80);
+    
+    //Socket socket;
+    char buf[1024];
+    wifi.connect(*wifi.endpoint);
+    wifi.recv(buf, 1024);
+    wifi.send(buf, sizeof(buf));
+    wifi.close(*wifi.endpoint);
 
     wifi.disconnect();