ex_flux v0.2.0 ExFlux.Conn.UDP View Source

Light, opinionated wrapper around :gen_udp

Link to this section Summary

Functions

when possible, sockets should be closed as a well-behaved program

open a port for UDP with all of the configuration afforded to you by :gen_udp.open/2

convert the string to utf-8 binary and send via udp

Link to this section Functions

Link to this function

close(socket)

View Source
close(socket :: :gen_udp.socket()) :: :ok

when possible, sockets should be closed as a well-behaved program

Link to this function

open(port \\ 0, udp_opts \\ [:binary, {:active, false}])

View Source
open(port :: :inet.port_number() | integer(), udp_opts :: [:gen_udp.option()]) ::
  :gen_udp.socket()

open a port for UDP with all of the configuration afforded to you by :gen_udp.open/2

Link to this function

write(socket, host, port, payload)

View Source
write(
  socket :: :gen_udp.socket(),
  host :: :inet.ip_address(),
  port :: :inet.port_number() | integer(),
  String.t()
) :: :ok | {:error, reason :: any()}

convert the string to utf-8 binary and send via udp