v2026.11.3
All Bundles
Bundle

Provides network support

DTLSSocketServer

DTLS/UDP secure server socket

Operations

Accept #

Accepts a client connection

method : public : Accept() ~ DTLSSocket

Return

TypeDescription
DTLSSocketclient 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 DTLS 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, and a certificate that failed verification is described with each reason mbedTLS gives.

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. Every listener the server binds after an accept takes this same port.

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. The server keeps to that address after each client it accepts. 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