View Source Soyaki.Socket (soyaki v1.0.1)
A struct that keeps track of options, and the underlying socket pid. Provides functionality to link/unlink, send, receive, and close. Banged versions might be a thing one day.
Link to this section Summary
Functions
Subscribes the calling process to the next packet to arrive in the socket. Can send one of 3 messages
Returns a specification to start this module under a supervisor.
Closes the socket. If specified, a final packet would be sent. Bold of you to expect for it to arrive, though.
Links a socket to the calling process.
Listens for a packet to arrive in the socket. Blocks the calling process.
Sends a udp packet to the connected ip and port.
Uninks a socket from the calling process.
Link to this section Types
@type options() :: []
A reference to a socket along with some info.
Link to this section Functions
Subscribes the calling process to the next packet to arrive in the socket. Can send one of 3 messages:
:timeout
{:udp_closed, nil}
{:udp, nil, packet}
Returns a specification to start this module under a supervisor.
See Supervisor
.
Closes the socket. If specified, a final packet would be sent. Bold of you to expect for it to arrive, though.
@spec link(t()) :: :ok
Links a socket to the calling process.
Listens for a packet to arrive in the socket. Blocks the calling process.
Sends a udp packet to the connected ip and port.
@spec unlink(t()) :: :ok
Uninks a socket from the calling process.