IP.SockAddr (net_address v0.3.1) View Source

Tools for handling the t::socket.sockaddr_in4/0 type.

Unless you're using the :socket library, for low level socket access you probably won't need this module!

Support for inet6 forthcoming.

Link to this section Summary

Functions

Like from_string/1, but returns an ok or error tuple on failure.

Creates an elixir struct, which is compatible with :socket module's sockaddr_in4 type.

converts a t::socket.sockaddr_in4 value to

Link to this section Types

Specs

t() :: :socket.sockaddr_in4() | :socket.sockaddr_in6()

Link to this section Functions

Link to this function

from_string(sockaddr_str)

View Source

Specs

from_string(String.t()) :: {:ok, t()} | {:error, term()}

Like from_string/1, but returns an ok or error tuple on failure.

Link to this function

from_string!(sockaddr_str)

View Source

Specs

from_string!(String.t()) :: t()

Creates an elixir struct, which is compatible with :socket module's sockaddr_in4 type.

You may pass this, for example to :socket.bind/2

Specs

to_string(t()) :: String.t()

converts a t::socket.sockaddr_in4 value to

Compatible with sockaddr maps returned by the socket library, not selective on the IP.SockAddr struct.