Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit ece732d

Browse files
author
Janne Kiiskilä
committed
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.
1 parent 79a64a4 commit ece732d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

simpleclient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class MbedClient: public M2MInterfaceObserver {
124124
void *handler=NULL) {
125125
// Randomizing listening port for Certificate mode connectivity
126126
_server_address = server_address;
127-
uint16_t port = rand() % 65535 + 12345;
127+
uint16_t port = 0; // Network interface will randomize with port 0
128128

129129
// create mDS interface object, this is the base object everything else attaches to
130130
_interface = M2MInterfaceFactory::create_interface(*this,

0 commit comments

Comments
 (0)