GSMLG.Socket.Stream.Protocol protocol (GSMLG.Socket v0.1.0)

Link to this section Summary

Functions

Close the socket.

Send a file through the socket, using non-copying operations where available.

Receive data from the socket compatible with the packet type.

Receive data from the socket with the given length or options.

Receive data from the socket with the given length and options.

Receive data from the socket until {:error, :closed} is returned.

Send data through the socket.

Shutdown the socket in the given mode, either :both, :read, or :write.

Link to this section Types

@type t() :: term()

Link to this section Functions

@spec close(t()) :: :ok | {:error, term()}

Close the socket.

Link to this function

file(self, path, options \\ [])

@spec file(t(), String.t(), Keyword.t()) :: :ok | {:error, term()}

Send a file through the socket, using non-copying operations where available.

@spec recv(t()) :: {:ok, term()} | {:error, term()}

Receive data from the socket compatible with the packet type.

Link to this function

recv(self, length_or_options)

@spec recv(t(), non_neg_integer() | Keyword.t()) :: {:ok, term()} | {:error, term()}

Receive data from the socket with the given length or options.

Link to this function

recv(self, length, options)

@spec recv(t(), non_neg_integer(), Keyword.t()) :: {:ok, term()} | {:error, term()}

Receive data from the socket with the given length and options.

Link to this function

recv_all!(self, acc \\ "")

@spec recv_all!(t(), String.t()) :: String.t()

Receive data from the socket until {:error, :closed} is returned.

Link to this function

send(self, data)

@spec send(t(), iodata()) :: :ok | {:error, term()}

Send data through the socket.

Link to this function

shutdown(self, how \\ :both)

@spec shutdown(t(), :both | :read | :write) :: :ok | {:error, term()}

Shutdown the socket in the given mode, either :both, :read, or :write.