mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-26 07:02:15 +03:00
Implement remoteIP and remotePort in WiFiUDP
This commit is contained in:
@ -102,6 +102,24 @@ public:
|
||||
return _rx_buf->len - _rx_buf_offset;
|
||||
}
|
||||
|
||||
uint32_t getRemoteAddress()
|
||||
{
|
||||
if (!_rx_buf)
|
||||
return 0;
|
||||
|
||||
struct ip_hdr* iphdr = (struct ip_hdr*) (((uint8_t*)_rx_buf->payload) - UDP_HLEN - IP_HLEN);
|
||||
return iphdr->src.addr;
|
||||
}
|
||||
|
||||
uint16_t getRemotePort()
|
||||
{
|
||||
if (!_rx_buf)
|
||||
return 0;
|
||||
|
||||
struct udp_hdr* udphdr = (struct udp_hdr*) (((uint8_t*)_rx_buf->payload) - UDP_HLEN);
|
||||
return ntohs(udphdr->src);
|
||||
}
|
||||
|
||||
bool next()
|
||||
{
|
||||
if (!_rx_buf)
|
||||
|
@ -39,6 +39,9 @@
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
|
||||
#define EBUF_LWIP 1
|
||||
#define LWIP_ESP 1
|
||||
#define EP_OFFSET 36
|
||||
/*
|
||||
-----------------------------------------------
|
||||
---------- Platform specific locking ----------
|
||||
@ -242,7 +245,7 @@
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#ifndef MEMP_NUM_TCP_PCB
|
||||
#define MEMP_NUM_TCP_PCB 5
|
||||
#define MEMP_NUM_TCP_PCB (*((volatile uint32*)0x600011FC))
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user