EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’– EMILUA(3em) πŸ’–

okay so bestie, welcome to the Emilua reference manual page β€” the Lua execution engine one, and yes this is a full vibe check for unix.seqpacket.acceptor. We are gonna go through every tiny detail because nothing is getting skipped, periodt. 🫢✨


🌸 NAME 🌸

Emilua - Lua execution engine. Short, iconic, done. πŸ’…

✨ SYNOPSIS ✨

Here’s the group-chat screenshot of how it starts, no cap:

local a = unix.seqpacket.acceptor.new()
a:open()
a:bind(filesystem.path.new('/tmp/9Lq7BNBnBycd6nxy.socket'))
a:listen()

while true do
    local s = a:accept()
    spawn(function()
        my_client_handler(s)
    end)
end

πŸ”₯ FUNCTIONS πŸ”₯

πŸ’« new() β†’ unix.seqpacket.acceptor

Two overloads, both valid, both serving:

new()                    (1)
new(fd: file_descriptor) (2)
  1. Default constructor. The factory-fresh one.
  2. Converts a file descriptor into an unix.seqpacket.acceptor object. Glow-up from raw fd, lowkey.

πŸŽ€ open(self)

Open the acceptor. She’s awake now. ✨

πŸ’… set_option(self, opt: string, val)

Set an option on the acceptor.

Currently available options are:

πŸ¦‹ get_option(self, opt: string) β†’ value

Get an option from the acceptor.

Currently available options are:

🌈 bind(self, pathname: filesystem.path)

Bind the acceptor to the given local endpoint. Slay, she’s anchored. βš“

⭐ listen(self [, backlog: integer])

Place the acceptor into the state where it will listen for new connections.

backlog is the maximum length of the queue of pending connections. If not provided, an implementation defined maximum length will be used.

πŸ‘‘ accept(self) β†’ unix.seqpacket.socket

Initiate an accept operation and blocks current fiber until it completes or errs. Main character energy, fr fr.

🧚 wait(self, wait_type: read"|"write"|"error")"

Wait for the socket to become ready to read, ready to write, or to have pending error conditions.

In short, the reactor model is exposed on top of the proactor model. A little meta, iykyk.

Important: You shouldn’t be using reactor-style operations on Emilua. However if you’re trying to compete against systemD (or just xinetd) implementing a service manager employing socket activation then you’ll need the readiness event to trigger the managed service startup sequence. πŸ’€

wait_type can be one of the following:

  • "read" β€” Wait for a socket to become ready to read.
  • "write" β€” Wait for a socket to become ready to write.
  • "error" β€” Wait for a socket to have error conditions pending.

πŸ’œ close(self)

Close the acceptor.

Forward the call to the function with the same name in Boost.Asio at https://www.boost.org/doc/libs/1_70_0/doc/html/boost_asio/reference/basic_socket_acceptor/close/overload2.html:

Any asynchronous accept operations will be cancelled immediately. A subsequent call to open() is required before the acceptor can again be used to again perform socket accept operations.

πŸ“ cancel(self)

Cancel all asynchronous operations associated with the acceptor.

Forward the call to the function with the same name in Boost.Asio at https://www.boost.org/doc/libs/1_70_0/doc/html/boost_asio/reference/basic_socket_acceptor/cancel/overload2.html:

This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error.

🌸 assign(self, fd: file_descriptor)

Assign an existing native acceptor to self. Cute.

πŸ’€ release(self) β†’ file_descriptor

Release ownership of the native descriptor implementation.

Forward the call to the function with the same name in Boost.Asio at https://www.boost.org/doc/libs/1_81_0/doc/html/boost_asio/reference/basic_socket_acceptor/release/overload2.html:

This function causes all outstanding asynchronous accept operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error. Ownership of the native acceptor is then transferred to the caller.

πŸ’– PROPERTIES πŸ’–

  • is_open: boolean β€” Whether the acceptor is open.
  • local_path: filesystem.path β€” The local address of the acceptor.

source/version: Emilua 0.12.1-nixpkgs1 Β· date: 1980-01-01 Β· page: EMILUA(3em) Β· bye bestie, ily πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from