1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00
esp8266/doc/esp8266wifi/udp-class.rst
ZaPpInG 1eb0645dcb Improve the compatibility of the doc between Github and RTD... (#4800)
* Update requirements.txt

* Update conf.py

* Update libraries.rst

* Update libraries.rst

* Update libraries.rst

* Update stack_dump.rst

* Update client-examples.rst

* Update readme.rst

* Update readme.rst

* Update server-class.rst

* Update server-examples.rst

* Update soft-access-point-class.rst

* Update station-class.rst

* Update station-examples.rst

* Update udp-class.rst

* Update udp-examples.rst

* Update a04-board-generic-is-unknown.rst

* Update readme.rst

* Update readme.rst

* Update readme.rst
2018-06-28 10:58:33 -04:00

2.2 KiB

orphan

UDP Class

Methods documented for WiFiUDP Class in Arduino

  1. begin()
  2. available()
  3. beginPacket()
  4. endPacket()
  5. write()
  6. parsePacket()
  7. peek()
  8. read()
  9. flush()
  10. stop()
  11. remoteIP()
  12. remotePort()

Methods and properties described further down are specific to ESP8266. They are not covered in Arduino WiFi library documentation. Before they are fully documented please refer to information below.

Multicast UDP

uint8_t  beginMulticast (IPAddress interfaceAddr, IPAddress multicast, uint16_t port) 
virtual int  beginPacketMulticast (IPAddress multicastAddress, uint16_t port, IPAddress interfaceAddress, int ttl=1) 
IPAddress  destinationIP () 
uint16_t  localPort ()

The WiFiUDP class supports sending and receiving multicast packets on STA interface. When sending a multicast packet, replace udp.beginPacket(addr, port) with udp.beginPacketMulticast(addr, port, WiFi.localIP()). When listening to multicast packets, replace udp.begin(port) with udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port). You can use udp.destinationIP() to tell whether the packet received was sent to the multicast or unicast address.

For code samples please refer to separate section with examples dedicated specifically to the UDP Class.