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_tbeginMulticast(IPAddressmulticast,uint16_tport)
virtualintbeginPacketMulticast(IPAddressmulticastAddress,uint16_tport,IPAddressinterfaceAddress,intttl=1)
IPAddressdestinationIP()
uint16_tlocalPort()

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(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.