Tortoise311.Transport behaviour (tortoise311 v0.12.1)
View SourceAbstraction for working with network connections; this is done to
normalize the :ssl
and :gen_tcp
modules, so they get a similar
interface.
This work has been heavily inspired by the Ranch project by NineNines.
Summary
Types
Callbacks
@callback close(socket()) :: :ok
@callback peername(socket()) :: {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, atom()}
@callback recv(socket(), non_neg_integer(), timeout()) :: {:ok, any()} | {:error, :closed | :timeout | atom()}
@callback sockname(socket()) :: {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, atom()}