socket v0.3.13 Socket.UDP
This module wraps a UDP socket using gen_udp.
Options
When creating a socket you can pass a series of options to use for it.
:assets the kind of value returned by recv, either:binaryor:list, the default is:binary.:modecan be either:passiveor:active, default is:passive:localmust be a keyword list:addressthe local address to use:fdan already opened file descriptor to use
:versionsets the IP version to use:broadcastenables broadcast sending
Examples
server = Socket.UDP.open!(1337)
{ data, client } = server |> Socket.Datagram.recv!
server |> Socket.Datagram.send! data, client
Link to this section Summary
Functions
Convert UDP options to :inet.setopts compatible arguments
Create a UDP socket listening on an OS chosen port, use local to know the
port it was bound on
Create a UDP socket listening on the given port or using the given options
Create a UDP socket listening on the given port and using the given options
Create a UDP socket listening on an OS chosen port, use local to know the
port it was bound on, raising if an error occurs
Create a UDP socket listening on the given port or using the given options, raising if an error occurs
Create a UDP socket listening on the given port and using the given options, raising if an error occurs
Set options of the socket
Set the process which will receive the messages
Set the process which will receive the messages, raising if an error occurs
Link to this section Types
Link to this section Functions
Convert UDP options to :inet.setopts compatible arguments.
Create a UDP socket listening on an OS chosen port, use local to know the
port it was bound on.
open(:inet.port_number() | Keyword.t()) :: {:ok, t()} | {:error, Error.t()}
Create a UDP socket listening on the given port or using the given options.
open(:inet.port_number(), Keyword.t()) :: {:ok, t()} | {:error, Error.t()}
Create a UDP socket listening on the given port and using the given options.
Create a UDP socket listening on an OS chosen port, use local to know the
port it was bound on, raising if an error occurs.
open!(:inet.port_number() | Keyword.t()) :: t() | no_return()
Create a UDP socket listening on the given port or using the given options, raising if an error occurs.
open!(:inet.port_number(), Keyword.t()) :: t() | no_return()
Create a UDP socket listening on the given port and using the given options, raising if an error occurs.
Set options of the socket.
Set the process which will receive the messages.
Set the process which will receive the messages, raising if an error occurs.