Skip to content

Commit b7bad77

Browse files
author
Teemu Kultala
committed
random socket port number
1 parent 52cb119 commit b7bad77

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

features/cellular/framework/common/CellularUtil.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
#include "CellularUtil.h"
18+
#include "randLIB.h"
1819
#include <string.h>
1920
#include <stdlib.h>
2021

@@ -315,12 +316,9 @@ int char_str_to_hex_str(const char* str, uint16_t len, char *buf, bool omit_lead
315316

316317
uint16_t get_dynamic_ip_port()
317318
{
318-
static uint16_t port;
319-
port++;
320-
if (port < 49152) {
321-
port = 49152;
322-
}
323-
return port;
319+
randLIB_seed_random();
320+
321+
return (randLIB_get_16bit() | 0xC000);
324322
}
325323

326324
} // namespace mbed_cellular_util

0 commit comments

Comments
 (0)