glisten/tcp

Values

pub fn accept_timeout(
  socket: socket.ListenSocket,
  timeout: Int,
) -> Result(socket.Socket, socket.SocketReason)
pub fn close(socket: a) -> Result(Nil, socket.SocketReason)
pub fn controlling_process(
  socket: socket.Socket,
  pid: process.Pid,
) -> Result(Nil, atom.Atom)
pub fn do_shutdown(
  socket: socket.Socket,
  write: atom.Atom,
) -> Result(Nil, socket.SocketReason)
pub fn get_socket_opts(
  socket: socket.Socket,
  opts: List(atom.Atom),
) -> Result(List(#(atom.Atom, dynamic.Dynamic)), Nil)
pub fn handshake(
  socket: socket.Socket,
) -> Result(socket.Socket, Nil)
pub fn listen(
  port: Int,
  opts: List(options.TcpOption),
) -> Result(socket.ListenSocket, socket.SocketReason)

Start listening over TCP on a port with the given options

pub fn negotiated_protocol(socket: socket.Socket) -> a
pub fn peername(
  socket: socket.Socket,
) -> Result(#(dynamic.Dynamic, Int), Nil)
pub fn receive(
  socket: socket.Socket,
  length: Int,
) -> Result(BitArray, socket.SocketReason)
pub fn receive_timeout(
  socket: socket.Socket,
  length: Int,
  timeout: Int,
) -> Result(BitArray, socket.SocketReason)
pub fn send(
  socket: socket.Socket,
  packet: bytes_tree.BytesTree,
) -> Result(Nil, socket.SocketReason)
pub fn set_opts(
  socket: socket.Socket,
  opts: List(options.TcpOption),
) -> Result(Nil, Nil)

Update the optons for a socket (mutates the socket)

pub fn shutdown(
  socket: socket.Socket,
) -> Result(Nil, socket.SocketReason)
pub fn socket_info(socket: socket.Socket) -> dict.Dict(a, b)
pub fn sockname(
  socket: socket.ListenSocket,
) -> Result(#(dynamic.Dynamic, Int), socket.SocketReason)
Search Document