v2026.11.3
All Bundles
Bundle

Provides network support

TCPSecureSocketServer

Secure TCP/IP Server socket

Operations

Accept #

Accepts a client connection

method : public : Accept() ~ TCPSecureSocket

Return

TypeDescription
TCPSecureSocketclient socket interface

Close #

Closes the server socket

method : public : Close() ~ Nil

GetIssuer #

Gets the X.509 certificate's issuer name

method : public : GetIssuer() ~ String

Return

TypeDescription
Stringcertificate issuer name

GetLastError # function

Gets the calling thread's last TLS failure, from a connect, listen, accept, read or write; each of those replaces it, and one that works leaves none. A connect that failed says why the system refused it, e.g. "NET - The connection to the given server / port failed: Connection refused". A certificate that failed verification is described with each reason mbedTLS gives, e.g. "X509 - Certificate verification failed, e.g. CRL, CA or signature check failed: The certificate is not correctly signed by the trusted CA".

function : GetLastError() ~ String

Return

TypeDescription
Stringlast error message, or Nil if there was none

GetPort #

Gets the port this server is bound to: the port given to New, or, for a port of 0, the one the system chose when Listen() bound the socket, so a program needs no fixed port number. Before Listen() it is the port given.

method : public : GetPort() ~ Int

Return

TypeDescription
Intbound port

GetSubject #

Gets the X.509 certificate subject name

method : public : GetSubject() ~ String

Return

TypeDescription
Stringcertificate subject name

Listen #

Listens for incoming client connections

method : public : Listen() ~ Bool

Return

TypeDescription
Booltrue if client successfully connects, false otherwise

New # constructor

Default constructor

New(cert:String, key:String, passwd:String, port:Int)

Parameters

NameTypeDescription
certStringpath to ssl cert
keyStringpath to ssl key
passwdStringprivate key password
portIntserver port

New # constructor

Constructor that binds one local address instead of every interface. The address is read as by TCPSocketServer->New(address, port): a literal such as "127.0.0.1" or "::1", or a host name, of which the first IPv4 address (else the first IPv6 one) is bound; an empty or Nil address binds every interface. A bad address makes Listen() return false.

New(cert:String, key:String, passwd:String, address:String, port:Int)

Parameters

NameTypeDescription
certStringpath to ssl cert
keyStringpath to ssl key
passwdStringprivate key password
addressStringlocal address to bind
portIntserver port