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 property. You can also find out how much data the RX buffer currently contains with the sock.rxlen property. From these two data, 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 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 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 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" properties: sock.txlen and sock.newtxlen. The txlen property returns the total amount of data waiting to be sent from the buffer. The newtxlen property returns the amount of data which 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 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. Notice, however, that this will only work when the network connection is closed (sock.statesimple= PL_SSTS_CLOSED).