mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
Add remoteIP and remotePort methods to WiFiClient
This commit is contained in:
@ -43,11 +43,10 @@ extern "C"
|
||||
#define MIN_LOCAL_PORT 1024
|
||||
#define MAX_LOCAL_PORT 1124
|
||||
|
||||
static int g_localPort = MIN_LOCAL_PORT;
|
||||
static int g_localPort = MIN_LOCAL_PORT;
|
||||
|
||||
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
|
||||
: _client(0)
|
||||
, _lastPollTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -229,6 +228,22 @@ ICACHE_FLASH_ATTR WiFiClient::operator bool()
|
||||
return _client != 0;
|
||||
}
|
||||
|
||||
IPAddress WiFiClient::remoteIP()
|
||||
{
|
||||
if (!_client)
|
||||
return IPAddress(0U);
|
||||
|
||||
return IPAddress(_client->getRemoteAddress());
|
||||
}
|
||||
|
||||
uint16_t WiFiClient::remotePort()
|
||||
{
|
||||
if (!_client)
|
||||
return 0;
|
||||
|
||||
return _client->getRemotePort();
|
||||
}
|
||||
|
||||
int8_t ICACHE_FLASH_ATTR WiFiClient::_s_connected(void* arg, void* tpcb, int8_t err)
|
||||
{
|
||||
return reinterpret_cast<WiFiClient*>(arg)->_connected(tpcb, err);
|
||||
|
Reference in New Issue
Block a user