function TlsStream.close
Close the stream. A TLS stream tells its peer first. Closing twice is harmless; any other use after closing fails. A stream that is dropped closes by itself.
function TlsStream.flush
Send whatever is buffered. A TLS stream buffers the records it encrypts; a plain socket has nothing to flush.
function TlsStream.local_addr
This end’s address, as
"ip:port".
function TlsStream.peer_addr
The peer’s address, as
"ip:port".
function TlsStream.read
Read at most
n bytes, and at most 64 KiB: whatever arrives first, at least one byte unless the peer has closed its end, where it returns b"". Call it again for more.
function TlsStream.read_exact
Read exactly
n bytes. A peer that closes first fails it with kind == "unexpected_eof".
function TlsStream.read_to_end
Read until the peer closes its end.
function TlsStream.read_to_string
Read until the peer closes its end, as text. Bytes that are not UTF-8 fail it with
kind == "invalid_data".
function TlsStream.set_nodelay
Turn Nagle’s algorithm off (
True) so small writes go out at once, or back on (False).
function TlsStream.set_read_timeout
Fail any later read that waits longer than
timeout_ms with kind == "timed_out". None waits as long as the OS does.
function TlsStream.set_write_timeout
Fail any later write that waits longer than
timeout_ms with kind == "timed_out". None waits as long as the OS does.
function TlsStream.shutdown
Shut down the
"read" half, the "write" half, or "both". After shutting down writes, the peer reads the end of the stream: the way to tell a peer that waits for it that the request is complete. A TLS stream tells its peer first, so the end is not mistaken for a cut.
function TlsStream.try_flush
flush, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.try_local_addr
local_addr, returning an (err, str) pair instead of raising a std.io.Error.
function TlsStream.try_peer_addr
peer_addr, returning an (err, str) pair instead of raising a std.io.Error.
function TlsStream.try_read
read, returning an (err, bytes) pair instead of raising a std.io.Error.
function TlsStream.try_read_exact
read_exact, returning an (err, bytes) pair instead of raising a std.io.Error.
function TlsStream.try_read_to_end
read_to_end, returning an (err, bytes) pair instead of raising a std.io.Error.
function TlsStream.try_read_to_string
read_to_string, returning an (err, str) pair instead of raising a std.io.Error.
function TlsStream.try_set_nodelay
set_nodelay, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.try_set_read_timeout
set_read_timeout, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.try_set_write_timeout
set_write_timeout, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.try_shutdown
shutdown, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.try_write
write, returning an (err, int) pair instead of raising a std.io.Error.
function TlsStream.try_write_all
write_all, returning an (err, None) pair instead of raising a std.io.Error.
function TlsStream.write
Write some of
data and return how many bytes were written, which can be fewer than len(data). Use write_all to write all of it.
function TlsStream.write_all
Write all of
data, a string or bytes.
