.nextpacket Method

Function:

For the selected socket (selection is made through sock.num) in the UDP mode (sock.protocol = 0 — PL_SOCK_PROTOCOL_UDP), closes processing of the current UDP datagram and moves to the next datagram.

Syntax:

sock.nextpacket()

Returns:

---

See Also:

---


Details

For UDP, the sock.getdata method only extracts the data from a single UDP datagram, even if several datagrams are stored in the RX buffer. When incoming UDP datagram processing is based on the on_sock_data_arrival event, the use of the sock.nextpacket method is not required, since each invocation of the on_sock_data_arrival event handler "moves" processing to the next UDP datagram.

This method is useful when it is necessary to move to the next datagram without re-entering the on_sock_data_arrival event handler. Therefore, sock.nextpacket is only necessary when the application needs to process several incoming UDP packets at once and within a single event handler.


.nextpacket Method

Details