mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-15 00:02:49 +03:00
@ -36,7 +36,7 @@ Once we have libraries in place we need to create a ``WiFiUDP`` object. Then we
|
|||||||
WiFiUDP Udp;
|
WiFiUDP Udp;
|
||||||
unsigned int localUdpPort = 4210;
|
unsigned int localUdpPort = 4210;
|
||||||
char incomingPacket[255];
|
char incomingPacket[255];
|
||||||
char replyPacekt[] = "Hi there! Got the message :-)";
|
char replyPacket[] = "Hi there! Got the message :-)";
|
||||||
|
|
||||||
Wi-Fi Connection
|
Wi-Fi Connection
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
@ -85,7 +85,7 @@ For each received packet we are sending back an acknowledge packet:
|
|||||||
.. code:: cpp
|
.. code:: cpp
|
||||||
|
|
||||||
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
|
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
|
||||||
Udp.write(replyPacekt);
|
Udp.write(replyPacket);
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
|
|
||||||
Please note we are sending reply to the IP and port of the sender by using ``Udp.remoteIP()`` and ``Udp.remotePort()``.
|
Please note we are sending reply to the IP and port of the sender by using ``Udp.remoteIP()`` and ``Udp.remotePort()``.
|
||||||
|
Reference in New Issue
Block a user