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:
@ -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);
|
||||
|
Reference in New Issue
Block a user