This is a simple mbed client example demonstrating, registration of a device with mbed Device Connector and reading and writing values as well as deregistering on different Network Interfaces including Ethernet, WiFi, 6LoWPAN ND and Thread respectively.

Dependencies:   lwip

Fork of mbed-os-example-client by mbed-os-examples

Revision:
31:218ca6b6fe19
Parent:
21:b88cdeb5b302
Child:
32:7b3841243d70
--- a/simpleclient.h	Tue Nov 22 15:00:11 2016 +0000
+++ b/simpleclient.h	Wed Nov 23 13:45:10 2016 +0000
@@ -103,16 +103,10 @@
     */
     void create_interface(const char *server_address,
                           void *handler=NULL) {
-    // Randomizing listening port for Certificate mode connectivity
+    // Set port to zero, network stack randomizes it then.
     _server_address = server_address;
-    uint16_t port = rand() % 65535 + 12345;
+    uint16_t port = 0;
 
-    // In case of Mesh or Thread use M2MInterface::Nanostack_IPv6
-#if MBED_CONF_APP_NETWORK_INTERFACE == MESH_LOWPAN_ND
-    NETWORK_STACK = M2MInterface::Nanostack_IPv6;
-#elif MBED_CONF_APP_NETWORK_INTERFACE == MESH_THREAD
-    NETWORK_STACK = M2MInterface::Nanostack_IPv6;
-#endif
 
     // create mDS interface object, this is the base object everything else attaches to
     _interface = M2MInterfaceFactory::create_interface(*this,