mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-10 04:22:05 +03:00
Fix UDP send to not temporarily use connect()
This commit is contained in:
@ -132,14 +132,13 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port)
|
||||
|
||||
int WiFiUDP::beginPacket(IPAddress ip, uint16_t port)
|
||||
{
|
||||
ip_addr_t addr;
|
||||
addr.addr = ip;
|
||||
|
||||
if (!_ctx) {
|
||||
_ctx = new UdpContext;
|
||||
_ctx->ref();
|
||||
}
|
||||
return (_ctx->connect(addr, port)) ? 1 : 0;
|
||||
begunIp_ = ip;
|
||||
begunPort_= port;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port,
|
||||
@ -167,8 +166,9 @@ int WiFiUDP::endPacket()
|
||||
if (!_ctx)
|
||||
return 0;
|
||||
|
||||
_ctx->send();
|
||||
_ctx->disconnect();
|
||||
ip_addr_t addr;
|
||||
addr.addr = begunIp_;
|
||||
_ctx->send(&addr, begunPort_);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user