mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
fix UdpContext::(connect,listen) signature by using IPAddress (#5742)
* fix UdpContext::listen signature by using IPAddress * fix UdpContext::connect signature by using IPAddress by courtesy of @AlfredLamoule
This commit is contained in:
parent
5948b0fc52
commit
6c5269a74b
@ -90,20 +90,40 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool connect(const ip_addr_t* addr, uint16_t port)
|
#if LWIP_VERSION_MAJOR == 1
|
||||||
|
|
||||||
|
bool connect(IPAddress addr, uint16_t port)
|
||||||
{
|
{
|
||||||
_pcb->remote_ip = *addr;
|
_pcb->remote_ip = addr;
|
||||||
_pcb->remote_port = port;
|
_pcb->remote_port = port;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool listen(CONST ip_addr_t* addr, uint16_t port)
|
bool listen(IPAddress addr, uint16_t port)
|
||||||
{
|
{
|
||||||
udp_recv(_pcb, &_s_recv, (void *) this);
|
udp_recv(_pcb, &_s_recv, (void *) this);
|
||||||
err_t err = udp_bind(_pcb, addr, port);
|
err_t err = udp_bind(_pcb, addr, port);
|
||||||
return err == ERR_OK;
|
return err == ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else // lwIP-v2
|
||||||
|
|
||||||
|
bool connect(const IPAddress& addr, uint16_t port)
|
||||||
|
{
|
||||||
|
_pcb->remote_ip = addr;
|
||||||
|
_pcb->remote_port = port;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool listen(const IPAddress& addr, uint16_t port)
|
||||||
|
{
|
||||||
|
udp_recv(_pcb, &_s_recv, (void *) this);
|
||||||
|
err_t err = udp_bind(_pcb, addr, port);
|
||||||
|
return err == ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // lwIP-v2
|
||||||
|
|
||||||
void disconnect()
|
void disconnect()
|
||||||
{
|
{
|
||||||
udp_disconnect(_pcb);
|
udp_disconnect(_pcb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user