We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 553bd7e commit c80dafdCopy full SHA for c80dafd
libraries/WiFi/src/WiFiUdp.cpp
@@ -41,15 +41,23 @@ void WiFiUDP::stop() {
41
}
42
43
int WiFiUDP::beginPacket(IPAddress ip, uint16_t port) {
44
- return 0;
+ remote_ip = ip;
45
+ _port = port;
46
+ return 1; // Return 1 if successful
47
48
49
int WiFiUDP::beginPacket(const char *host, uint16_t port) {
50
+ // Resolve the hostname to an IP address
51
+ IPAddress ip;
52
+ if (socket.hostByName(host, ip)) {
53
+ return beginPacket(ip, port); // Call the IP-based version
54
+ }
55
+
56
+ // Return 0 if hostname resolution fails
57
return 0;
58
59
60
int WiFiUDP::endPacket() {
61
62
63
size_t WiFiUDP::write(uint8_t) {
0 commit comments