View Source partisan_peer_socket (partisan v5.0.0-rc.8)

Wrapper that allows transparent usage of plain TCP or TLS socket for peer connections.

This module also implements the monotonic channel functionality.

Summary

Functions

Wraps a TCP socket with the appropriate information for transceiving on and controlling the socket later. If TLS/SSL is enabled, this performs the socket upgrade/negotiation before returning the wrapped socket.
Returns the wrapped socket from within the connection.

Types

-type options() :: [gen_tcp:option()] | map().
-type reason() :: closed | inet:posix().
-type t() :: #partisan_peer_socket{}.

Functions

-spec accept(gen_tcp:socket()) -> t().
Wraps a TCP socket with the appropriate information for transceiving on and controlling the socket later. If TLS/SSL is enabled, this performs the socket upgrade/negotiation before returning the wrapped socket.
Link to this function

close(Partisan_peer_socket)

View Source
-spec close(t()) -> ok.

See also: gen_tcp:close/1, ssl:close/1.

Link to this function

connect(Address, Port, Options)

View Source
-spec connect(inet:socket_address() | inet:hostname(), inet:port_number(), options()) ->
           {ok, t()} | {error, inet:posix()}.

See also: gen_tcp:connect/3, ssl:connect/3.

Link to this function

connect(Address, Port, Options, Timeout)

View Source
-spec connect(inet:socket_address() | inet:hostname(), inet:port_number(), options(), timeout()) ->
           {ok, t()} | {error, inet:posix()}.
Link to this function

connect(Address, Port, Options, Timeout, PartisanOptions)

View Source
-spec connect(inet:socket_address() | inet:hostname(),
        inet:port_number(),
        options(),
        timeout(),
        map() | list()) ->
           {ok, t()} | {error, inet:posix()}.
-spec recv(t(), integer()) -> {ok, iodata()} | {error, reason()}.

See also: gen_tcp:recv/2, ssl:recv/2.

Link to this function

recv(Partisan_peer_socket, Length, Timeout)

View Source
-spec recv(t(), integer(), timeout()) -> {ok, iodata()} | {error, reason()}.

See also: gen_tcp:recv/3, ssl:recv/3.

Link to this function

send(Partisan_peer_socket, Data)

View Source
-spec send(t(), iodata()) -> ok | {error, reason()}.

See also: gen_tcp:send/2, ssl:send/2.

Link to this function

setopts(Partisan_peer_socket, Options)

View Source
-spec setopts(t(), options()) -> ok | {error, inet:posix()}.

See also: inet:setopts/2, ssl:setopts/2.

-spec socket(t()) -> gen_tcp:socket() | ssl:sslsocket().
Returns the wrapped socket from within the connection.