This class is used to store the state of a DTLS server. Upon setup() it converts connected PacketPeerUDP to PacketPeerDTLS accepting them via take_connection() as DTLS clients. Under the hood, this class is used to store the DTLS state and cookies of the server. The reason of why the state and cookies are needed is outside of the scope of this documentation.
Below a small example of how to use it:
Setup the DTLS server to use the given server_options
. See TLSOptions.server().
Try to initiate the DTLS handshake with the given udp_peer
which must be already connected (see PacketPeerUDP.connect_to_host()).
Note: You must check that the state of the return PacketPeerUDP is PacketPeerDTLS.STATUS_HANDSHAKING, as it is normal that 50% of the new connections will be invalid due to cookie exchange.