glisten/transport

Types

pub type IpAddress {
  IpV4(Int, Int, Int, Int)
  IpV6(Int, Int, Int, Int, Int, Int, Int, Int)
}

Constructors

  • IpV4(Int, Int, Int, Int)
  • IpV6(Int, Int, Int, Int, Int, Int, Int, Int)
pub type Transport {
  Tcp
  Ssl
}

Constructors

  • Tcp
  • Ssl

Functions

pub fn accept(
  transport: Transport,
  socket: ListenSocket,
) -> Result(Socket, SocketReason)
pub fn accept_timeout(
  transport: Transport,
  socket: ListenSocket,
  timeout: Int,
) -> Result(Socket, SocketReason)
pub fn close(
  transport: Transport,
  socket: Socket,
) -> Result(Nil, SocketReason)
pub fn controlling_process(
  transport: Transport,
  socket: Socket,
  pid: Pid,
) -> Result(Nil, Atom)
pub fn decode_ip() -> fn(Dynamic) ->
  Result(IpAddress, List(DecodeError))
pub fn get_socket_opts(
  transport: Transport,
  socket: Socket,
  opts: List(Atom),
) -> Result(List(#(Atom, Dynamic)), Nil)
pub fn handshake(
  transport: Transport,
  socket: Socket,
) -> Result(Socket, Nil)
pub fn listen(
  transport: Transport,
  port: Int,
  opts: List(TcpOption),
) -> Result(ListenSocket, SocketReason)
pub fn negotiated_protocol(
  transport: Transport,
  socket: Socket,
) -> Result(String, String)
pub fn peername(
  transport: Transport,
  socket: Socket,
) -> Result(#(IpAddress, Int), Nil)
pub fn receive(
  transport: Transport,
  socket: Socket,
  amount: Int,
) -> Result(BitArray, SocketReason)
pub fn receive_timeout(
  transport: Transport,
  socket: Socket,
  amount: Int,
  timeout: Int,
) -> Result(BitArray, SocketReason)
pub fn send(
  transport: Transport,
  socket: Socket,
  data: BytesBuilder,
) -> Result(Nil, SocketReason)
pub fn set_buffer_size(
  transport: Transport,
  socket: Socket,
) -> Result(Nil, Nil)
pub fn set_opts(
  transport: Transport,
  socket: Socket,
  opts: List(TcpOption),
) -> Result(Nil, Nil)
pub fn shutdown(
  transport: Transport,
  socket: Socket,
) -> Result(Nil, SocketReason)
pub fn socket_info(socket: Socket) -> Dict(Atom, Dynamic)
pub fn sockname(
  transport: Transport,
  socket: ListenSocket,
) -> Result(#(IpAddress, Int), SocketReason)
Search Document