EMILUA(3em)
β¨ NAME β¨
Okay so this is EMILUA(3em), the Emilua reference page, bestie, and the NAME is Emilua - Lua execution engine. Thatβs the whole vibe. π
π SYNOPSIS π
Hereβs the synopsis, exactly as it appears, no cap:
local a = ip.tcp.acceptor.new()
a:open('v4')
a:set_option('reuse_address', true)
a:bind('127.0.0.1', 8080)
a:listen()
while true do
local s = a:accept()
spawn(function()
my_client_handler(s)
end)
end
β¨ FUNCTIONS β¨
π¦ new
new() β ip.tcp.acceptor
Constructor. Thatβs it. Iconic. π
πΈ open
open(self, address_family: v4"|"v6"|ip.address)"
Open the acceptor.
address_family can be either "v4" or "v6". If you provide an ip.address object, the appropriate value will be inferred. β¨
π set_option
set_option(self, opt: string, val)
Set an option on the acceptor.
Currently available options are:
"reuse_address"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/reuse_address.html."enable_connection_aborted"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/enable_connection_aborted.html."debug"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/debug.html."v6_only"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/ip%5F_v6_only.html.
π get_option
get_option(self, opt: string) β value
Get an option from the acceptor.
Currently available options are:
"reuse_address"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/reuse_address.html."enable_connection_aborted"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/enable_connection_aborted.html."debug"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/reference/socket_base/debug.html."v6_only"β Check the Boost.Asio documentation athttps://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/ip%5F_v6_only.html.
π bind
bind(self, addr: ip.address|string, port: integer)
Bind the acceptor to the given local endpoint. π
π listen
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
accept(self) β ip.tcp.socket
Initiate an accept operation and blocks the current fiber until it completes or errs. π₯
π¦ wait
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.
Important, bestie: 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
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
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
assign(self, address_family: v4"|"v6"|ip.address, fd: file_descriptor)"
Assign an existing native acceptor to self.
address_family can be either "v4" or "v6". If you provide an ip.address object, the appropriate value will be inferred. π§
π
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_address: ip.address
The local address endpoint of the acceptor.
π local_port: integer
The local port endpoint of the acceptor.
π okay bestie, thatβs the whole page. This lil gem is from Emilua 0.12.1-nixpkgs1, dated 1980-01-01, and itβs the EMILUA(3em) manual. periodt. πβ¨
π¦ where this page comes from
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms