StreamPeerTLS

Hereda: StreamPeer < RefCounted < Object

A stream peer that handles TLS connections.

Descripción

A stream peer that handles TLS connections. This object can be used to connect to a TLS server or accept a single TLS client connection.

Note: When exporting to Android, make sure to enable the INTERNET permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.

Tutoriales

Métodos

Error

accept_stream(stream: StreamPeer, server_options: TLSOptions)

Error

connect_to_stream(stream: StreamPeer, common_name: String, client_options: TLSOptions = null)

void

disconnect_from_stream()

Status

get_status() const

StreamPeer

get_stream() const

void

poll()


Enumeraciones

enum Status: 🔗

Status STATUS_DISCONNECTED = 0

Un estado que representa un StreamPeerTLS que está desconectado.

Status STATUS_HANDSHAKING = 1

Un estado que representa un StreamPeerTLS durante el handshaking.

Status STATUS_CONNECTED = 2

Un estado que representa un StreamPeerTLS que está conectado a un host.

Status STATUS_ERROR = 3

Un estado que representa un StreamPeerTLS en estado de error.

Status STATUS_ERROR_HOSTNAME_MISMATCH = 4

Un estado de error que muestra una falta de coincidencia en el dominio del certificado TLS presentado por el host y el dominio solicitado para la validación.


Descripciones de Métodos

Error accept_stream(stream: StreamPeer, server_options: TLSOptions) 🔗

Accepts a peer connection as a server using the given server_options. See TLSOptions.server().


Error connect_to_stream(stream: StreamPeer, common_name: String, client_options: TLSOptions = null) 🔗

Connects to a peer using an underlying StreamPeer stream and verifying the remote certificate is correctly signed for the given common_name. You can pass the optional client_options parameter to customize the trusted certification authorities, or disable the common name verification. See TLSOptions.client() and TLSOptions.client_unsafe().


void disconnect_from_stream() 🔗

Se desconecta del host.


Status get_status() const 🔗

Devuelve el estado de la conexión.


StreamPeer get_stream() const 🔗

Devuelve la conexión subyacente StreamPeer, utilizada en accept_stream() o connect_to_stream().


void poll() 🔗

Sondea la conexión para comprobar los bytes entrantes. Llama a esto justo antes de StreamPeer.get_available_bytes() para que funcione correctamente.