1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Add API to set the beginning of local ports range for WiFiClient

This commit is contained in:
Ivan Grokhotkov
2015-05-24 23:15:05 +03:00
parent 703cad32f6
commit 49aeb79b05
2 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,8 @@ extern "C"
#include "include/ClientContext.h"
#include "c_types.h"
uint16_t WiFiClient::_localPort = 0;
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
: _client(0)
{
@ -93,6 +95,10 @@ int ICACHE_FLASH_ATTR WiFiClient::connect(IPAddress ip, uint16_t port)
if (!pcb)
return 0;
if (_localPort > 0) {
pcb->local_port = _localPort++;
}
ip_addr_t addr;
addr.addr = ip;
tcp_arg(pcb, this);