TLS Buffer Allocation

TLS data flows through its own set of internal buffers that sit "behind" the socket's regular TX and RX buffers.

The WM2000 allocates the necessary TLS buffer space at boot, so no "manual" allocation in code is required. On the EM2000, EM2001, TPP2(G2), and TPP3(G2), you must call sock.tlsbuffrq followed by sys.buffalloc to allocate 39 buffer pages before attempting to establish a secure connection:

** Tibbo Basic **


sock.tlsbuffrq(39)     'A minimum of 39 buffer pages are required for TLS; 
                       'allocating more than 39 is not necessary

Although sock.tlsbuffrq appears to allocate a single buffer, internally this space is actually divided into several buffers, such as "TLS TX," "TLS RX," and some other buffers needed for correct TLS operation:

object_sock_tls