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 mbed-os-examples

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Dec 20 14:45:09 2016 +0000
Parent:
47:c64ceb183891
Child:
49:10f84adec19e
Commit message:
Use port=0 for randomization

Network stack will randomize the address once it's being set to port 0.
NOTE! Dependency on mbed OS 5.3, nanostack does the port randomization starting with mbedOS 5.3.

.
Commit copied from https://github.com/ARMmbed/mbed-os-example-client

Changed in this revision

simpleclient.h Show annotated file Show diff for this revision Revisions of this file
--- a/simpleclient.h	Fri Dec 16 13:15:09 2016 +0000
+++ b/simpleclient.h	Tue Dec 20 14:45:09 2016 +0000
@@ -124,7 +124,7 @@
                           void *handler=NULL) {
     // Randomizing listening port for Certificate mode connectivity
     _server_address = server_address;
-    uint16_t port = rand() % 65535 + 12345;
+    uint16_t port = 0; // Network interface will randomize with port 0
 
     // create mDS interface object, this is the base object everything else attaches to
     _interface = M2MInterfaceFactory::create_interface(*this,