class LUDP : public UDP;
class LUDP : public UDP;
LUDP Class
LUDP is the base implementation of LWiFiUDP and LGPRSUDP. You should not use LUDP instances directly. Instead, declare instances of LWiFiUDP or LGPRSUDP and use them to perform UDP socket operations.
Unlike LTcpClient and LTcpServer, a LUDP instance can send to and receive from multiple addresses. To achieve this, beginPacket() should be called first to assign remote address and port, followed by write() and finally endPacket(). Receiving packets works in a similar way. parsePacket() should be called first. After parsePacket() returns non-zero value, methods read(), available(), remoteIP() and remotePort() becomes meaningful. Each call to parsePacket() method starts the processing of a new incoming packet, which may have different retrun values from methods like remoteIP() and remotePort().
LUdp.h
|
Method |
Description |
|
Destructor. LUDP will close resources when it is destroyed. | |
|
Number of remaining bytes in the current packet. Only meaningful after parsePacket() returns non-zero. | |
|
Initializes UDP function, and start listening on specified local port. | |
|
Send the datagram after calling beginPacket() and write(). | |
|
Stop processing current packet. | |
|
return the value of next available byte from current packet. The byte remains in the packet. | |
|
Read 1 byte from current packet after calling parsePacket(); | |
|
Read up to len bytes from current packet after calling parsePacket(); | |
|
retrieve the sender IP address of the current packet started by parsePacket() | |
|
retrieve the sender port of the current packet started by parsePacket() | |
|
Stop listening for UDP datagram and uninitializes UDP module. | |
|
Append 1 single byte into the datagram | |
|
Append a buffer into the datagram. |