This is a quick example of a simple HTTP client program using the network-socket API that is provided as a part of mbed-os. The program brings up an underlying network interface, and uses it to perform an HTTP transaction over a TCPSocket.

Revision:
58:4aeb931b8475
Parent:
56:02a6401ec508
Child:
64:a3dc04daaa2a
--- a/main.cpp	Tue Aug 28 11:15:09 2018 +0100
+++ b/main.cpp	Mon Sep 03 08:45:04 2018 +0100
@@ -28,6 +28,7 @@
     r = net->connect();
     if (r != 0) {
         printf("Error! net->connect() returned: %d\n", r);
+        return r;
     }
 
     // Show the network address