Socket.Stream (sockets v2.1.5)

Copy Markdown

Unified interface for stream-based sockets (TCP, SSL, Port).

Delegates to Socket.Stream.Protocol and provides bang (!) variants of all operations, plus io/2,3 for streaming data from an IO device directly into a socket.

Summary

Types

t()

@type t() :: Socket.Stream.Protocol.t()

Functions

close(self)

See Socket.Stream.Protocol.close/1.

close!(self)

file(self, path, options)

See Socket.Stream.Protocol.file/3.

file!(self, path, options)

io(self, io, options \\ [])

@spec io(t(), :io.device(), Keyword.t()) :: :ok | {:error, term()}

Read from the IO device and send to the socket following the given options.

Options

  • :size is the amount of bytes to read from the IO device, if omitted it will read until EOF
  • :offset is the amount of bytes to read from the IO device before starting to send what's being read
  • :chunk_size is the size of the chunks read from the IO device at a time

io!(self, io)

io!(self, io, options)

recv(self)

See Socket.Stream.Protocol.recv/1.

recv(self, length_or_options)

See Socket.Stream.Protocol.recv/2.

recv(self, length, options)

See Socket.Stream.Protocol.recv/3.

recv!(self)

recv!(self, length_or_options)

recv!(self, length, options)

send(self, data)

See Socket.Stream.Protocol.send/2.

send!(self, data)

shutdown(self, how)

See Socket.Stream.Protocol.shutdown/2.

shutdown!(self, how)