OxL Справочник OxL
РусскийEnglish

method TlsStream.read

Up to max bytes of application data. An empty result means the peer closed TLS cleanly (close_notify); a connection that ended without it is Unavailable. A Timeout leaves the stream usable.

Example:

oxl✓ проверяется в CI
use std.net { TlsStream }

fn first(s: &TlsStream) -> bytes | NetError  net {
  s.read(4096, timeout: 2s)
}
pub(api) fn read(max: usize, timeout: Duration? = none) -> bytes | NetError  net

С версии. 1.0.0-beta

Параметры

ИмяТип
maxusize
timeoutDuration? = none

Возвращает

bytes

Ошибки

  • NetError
  • `Timeout`, `Unavailable` (also: the peer ended without `close_notify`), `Cancelled`, `ProtocolError` (`tls alert:` ...).

Эффекты

net

Определено в: std/net/tls.oxl:262

См. также