View Source Barytherium.Connection (barytherium v0.7.0)

Handles connection logic for both secure (SSL) and non-secure (TCP) connections.

Link to this section Summary

Link to this section Types

@type option() ::
  {:buffer, pos_integer()}
  | {:receive_buffer, pos_integer()}
  | {:send_buffer, pos_integer()}
  | {:send_timeout, pos_integer()}
  | {:socket_options, [:inet.socket_setopt()]}
  | {:secure, boolean()}
  | {:ssl_options, keyword()}

Link to this section Functions

@spec close(:gen_tcp.socket() | :ssl.ssl_socket()) :: :ok
Link to this function

connect(host, port, opts \\ [])

View Source
@spec connect(charlist(), :inet.port_number(), [option()]) ::
  {:ok, :gen_tcp.socket() | :ssl.ssl_socket()} | {:error, term()}
Link to this function

recv(socket, length, timeout)

View Source
@spec recv(:gen_tcp.socket() | :ssl.ssl_socket(), non_neg_integer(), timeout()) ::
  {:ok, binary()} | {:error, term()}
@spec send(:gen_tcp.socket() | :ssl.ssl_socket(), iodata()) :: :ok | {:error, term()}