![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.
Fork of mbed-os-example-client by
Diff: simpleclient.h
- Revision:
- 32:7b3841243d70
- Parent:
- 31:218ca6b6fe19
- Child:
- 37:9a9428fc4b26
--- a/simpleclient.h Wed Nov 23 13:45:10 2016 +0000 +++ b/simpleclient.h Wed Nov 23 14:00:11 2016 +0000 @@ -103,10 +103,16 @@ */ void create_interface(const char *server_address, void *handler=NULL) { - // Set port to zero, network stack randomizes it then. + // Randomizing listening port for Certificate mode connectivity _server_address = server_address; - uint16_t port = 0; + uint16_t port = rand() % 65535 + 12345; + // 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,