From 065326135e1393e33d95932bc3107ca9fea2432d Mon Sep 17 00:00:00 2001 From: Ari Parkkila Date: Tue, 13 Feb 2018 13:42:13 +0200 Subject: [PATCH] Change cellular socket port 0 to dynamic range --- features/cellular/framework/AT/AT_CellularDevice.h | 2 +- features/cellular/framework/AT/AT_CellularStack.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/features/cellular/framework/AT/AT_CellularDevice.h b/features/cellular/framework/AT/AT_CellularDevice.h index 8d45aab4ec..0a5bcefbb0 100644 --- a/features/cellular/framework/AT/AT_CellularDevice.h +++ b/features/cellular/framework/AT/AT_CellularDevice.h @@ -131,7 +131,7 @@ public: // CellularDevice * * @return network stack */ - NetworkStack *get_stack(); + virtual NetworkStack *get_stack(); protected: AT_CellularNetwork *_network; diff --git a/features/cellular/framework/AT/AT_CellularStack.cpp b/features/cellular/framework/AT/AT_CellularStack.cpp index c3c0b25e77..60c56e8757 100644 --- a/features/cellular/framework/AT/AT_CellularStack.cpp +++ b/features/cellular/framework/AT/AT_CellularStack.cpp @@ -173,6 +173,10 @@ nsapi_error_t AT_CellularStack::socket_bind(nsapi_socket_t handle, const SocketA } socket->localAddress = addr; + if (socket->localAddress.get_port() == 0) { + socket->localAddress.set_port(get_dynamic_ip_port()); + } + _at.lock(); if (!socket->created) {