.getdata Method
Function: |
For the selected socket (selection is made through sock.num), returns the string that contains the data extracted from the RX buffer. |
Syntax: |
ser.getdata(maxinplen as word) as string |
Returns: |
String containing data extracted from the RX buffer |
See Also: |
Part |
Description |
maxinplen |
Maximum amount of data to return (word). |
Details
The extracted data is permanently deleted from the buffer. The length of the extracted data is limited by one of the three factors (whichever is smaller): the amount of data in the RX buffer itself, the capacity of the "receiving" string variable, and the limit set by the maxinplen argument.
Additionally, if this socket uses the UDP transport protocol (sock.protocol = 1 — PL_SOCK_PROTOCOL_TCP), the length of the data that will be extracted is limited to the UDP datagram being processed. Additional conditions apply to UDP datagram processing; see on_sock_data_arrival event and the sock.nextpacket method.