Thousand Island v0.2.0 ThousandIsland.Socket View Source
Encapsulates a client connection's underlying socket, providing a facility to
read, write, and otherwise manipulate a connection from a client.
ThousandIsland.Socket
instances are passed to the application layer of a server
via the ThousandIsland.Handler.handle_connection/2
callback.
Link to this section Summary
Functions
Closes the given socket.
Returns information in the form of t:ThousandIsland.Transport.socket_info()
about the local end of the socket.
Returns information in the form of t:ThousandIsland.Transport.socket_info()
about the remote end of the socket.
Returns available bytes on the given socket. Up to num_bytes
bytes will be
returned (0 can be passed in to get the next 'available' bytes, typically the
next packet). If insufficient bytes are available, the functino can wait timeout
milliseconds for data to arrive.
Sends the given data (specified as a binary or an IO list) on the given socket.
Sends the contents of the given file based on the provided offset & length
Sets the given flags on the socket
Shuts down the socket in the given direction.
Link to this section Types
A reference to a socket along with metadata describing how to use it
Link to this section Functions
Closes the given socket.
local_info(socket)
View Sourcelocal_info(t()) :: ThousandIsland.Transport.socket_info()
Returns information in the form of t:ThousandIsland.Transport.socket_info()
about the local end of the socket.
peer_info(socket)
View Sourcepeer_info(t()) :: ThousandIsland.Transport.socket_info()
Returns information in the form of t:ThousandIsland.Transport.socket_info()
about the remote end of the socket.
recv(socket, length \\ 0, timeout \\ :infinity)
View Sourcerecv(t(), non_neg_integer(), timeout()) :: ThousandIsland.Transport.on_recv()
Returns available bytes on the given socket. Up to num_bytes
bytes will be
returned (0 can be passed in to get the next 'available' bytes, typically the
next packet). If insufficient bytes are available, the functino can wait timeout
milliseconds for data to arrive.
Sends the given data (specified as a binary or an IO list) on the given socket.
sendfile(socket, filename, offset, length)
View Sourcesendfile(t(), String.t(), non_neg_integer(), non_neg_integer()) :: {:ok, non_neg_integer()} | {:error, String.t()}
Sends the contents of the given file based on the provided offset & length
setopts(socket, options)
View Sourcesetopts(t(), ThousandIsland.Transport.socket_opts()) :: :ok | {:error, String.t()}
Sets the given flags on the socket
shutdown(socket, way)
View Sourceshutdown(t(), ThousandIsland.Transport.way()) :: :ok
Shuts down the socket in the given direction.