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) {