Change cellular socket port 0 to dynamic range

pull/6082/head
Ari Parkkila 2018-02-13 13:42:13 +02:00
parent 934a93151a
commit 065326135e
2 changed files with 5 additions and 1 deletions

View File

@ -131,7 +131,7 @@ public: // CellularDevice
*
* @return network stack
*/
NetworkStack *get_stack();
virtual NetworkStack *get_stack();
protected:
AT_CellularNetwork *_network;

View File

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