Skip to content
FutureBlitz

    Install

    Import std.net.tls

    TlsStream

    std.net.tls

    class

    Public Class TlsStream<S> Implements Reader, Writer

    TLS over S, a stream: what's written goes to the other side through TLS's records, and what's read came from it. A failure of TLS after the handshake throws an IOError, whose Cause is a NetError of TLS, and the stream's own failure is thrown as it was. Close sends close_notify, which a read on the other side ends at; one that ends without it throws an IOError of UNEXPECTED_END. Neither closes the stream it's on, which Stream gives.

    std/net/tls.fb, line 382

    • Public Property Stream: S property #

      The stream it's on.

    • Public Property Version: String property #

      The version of TLS the handshake agreed on: "TLS 1.2" or "TLS 1.3".

    • Public Property Protocol: String? property #

      The application protocol the server picked of those the client offered, or Null for none.

    • Public Property PeerCertificate: Certificate? property #

      The other side's certificate, or Null when it sent none, as a client asked for none does, or it's of a key std.crypto doesn't take.

    • Public Method Read(into: Buffer<UInt8>): Int64 Throws IOError method #

      Up to into.Count bytes of what the other side sent, once a record of them has come, or 0 once it closed with close_notify.

    • Public Async Method ReadAsync(into: Buffer<UInt8>): Int64 Throws IOError method #

      Read's Async twin: the next bytes TLS's records hold, which waits on the stream's ReadAsync while the main thread goes on.

    • Public Method Write(from: Buffer<UInt8>) Throws IOError method #

      Writes from's bytes to the other side, a record at a time. After Close, it throws an IOError whose Cause is a NetError of CLOSED.

    • Public Async Method WriteAsync(from: Buffer<UInt8>) Throws IOError method #

      Write's Async twin: the bytes, sealed in TLS's records, written by the stream's WriteAsync while the main thread goes on.

    • Public Method Flush() Throws IOError method #

      Flushes the other stream, which holds what it wrote.

    • Public Async Method FlushAsync() Throws IOError method #

      Flush's Async twin: flushes the stream, by its FlushAsync.

    • Public Method Close() Throws IOError method #

      Sends close_notify, which tells the other side nothing more comes, and flushes the other stream, the first time; a write after it throws. It doesn't close that stream, which Stream gives, and what the other side sends can still be read.

    • Public Async Method CloseAsync() Throws IOError method #

      What Close does, without blocking its thread: a call gives its Task.

    Report an issue with this page or with FutureBlitz on GitHub.