TX and RX Buffer Memory Status
You cannot effectively use a buffer without knowing what is its status. Is it overflowing? Can you add more data? etc. Thus, each of the socket buffers has certain properties which allow you to monitor it.
The RX Buffer
You can check the total capacity of the buffer with the sock.rxbuffsize read-only property. You can also find out how much data the RX buffer currently contains with the sock.rxlen read-only property. From these two properties, you can easily deduce how much free space you have in the RX buffer — even though this isn't such a useful datum (that's one of the reasons why there is no explicit property for it).
Note that sock.rxlen returns the gross current size of data in the RX buffer. In TCP mode, this is equivalent to the actual amount of data in the buffer. However, in UDP mode, this value includes the headers preceding each datagram within the RX buffer — the amount of actual data in the buffer is smaller than that. A separate read-only property — sock.rxpacketlen — returns the length of actual data in the UDP datagram you are currently processing.
Sometimes you need to clear the RX buffer without actually extracting the data. In such cases, the sock.rxclear method comes in handy.
The TX Buffer
Similarly to the RX buffer, the TX buffer also has a sock.txbuffsize property, which lets you discover its capacity.
The TX buffer has two "data length" read-only properties: sock.txlen and sock.newtxlen. The sock.txlen property returns the total amount of data waiting to be sent from the buffer. The sock.newtxlen property returns the amount of data that has entered the buffer, but has not yet been committed for sending (you commit the data by using the sock.send method). For UDP, this is basically the length of UDP datagram being created.
The TX buffer also has a sock.txfree read-only property, which directly tells you how much space is left in it.
sock.txfree = sock.txbuffsize - sock.txlen
When you want to clear the TX buffer without sending anything, use the sock.txclear method. Note, however, that this will only work when the network connection is closed (sock.statesimple = PL_SSTS_CLOSED).