UDP

parsePacket()

UDP::parsePacket, parsePacket, UDP.parsePacket

Checks for the presence of a UDP packet, and reports the size. parsePacket() must be called before reading the buffer with UDP.read().

It's usually more efficient to use receivePacket() instead of parsePacket() and read().

// PROTOTYPE
int parsePacket(system_tick_t timeout = 0);

// SYNTAX
size = Udp.parsePacket();

Parameters:

  • timeout: The timeout to wait for data in milliseconds, or 0 to not block in Device OS 2.0.0 and later. Prior to 2.0.0 this function did not block

Returns:

  • int: the size of a received UDP packet