Module
Module documentation.
moduleaio.udp
Classes
Classes and inheritance.
classaio.udp::Packet
@brief`Packet` type.
@details`Packet` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Packet {
/*
@brief `data` field.Functions
Free functions and class methods.
functionaio.udp::__aio_udp_bind
Signature
extern func __aio_udp_bind(host: String, port: Int) -> Int;extern func __aio_udp_bind(host: String, port: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__aio_udp_connect`.@briefBinds the low-level runtime symbol `__aio_udp_bind`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hostHost name or listen address.
- portPort number.
@returnReturns the operation result as `Int`.
functionaio.udp::__aio_udp_connect
Signature
extern func __aio_udp_connect(host: String, port: Int, timeout_ms: Int) -> Future(Int, ErrCode);extern func __aio_udp_connect(host: String, port: Int, timeout_ms: Int) -> Future(Int, ErrCode);
/*
@brief Binds the low-level runtime symbol `__aio_udp_sock_port`.@briefBinds the low-level runtime symbol `__aio_udp_connect`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hostHost name or listen address.
- portPort number.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::__aio_udp_sock_port
Signature
extern func __aio_udp_sock_port(fd: Int) -> Int;extern func __aio_udp_sock_port(fd: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__aio_udp_send`.@briefBinds the low-level runtime symbol `__aio_udp_sock_port`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns the operation result as `Int`.
functionaio.udp::__aio_udp_send
Signature
extern func __aio_udp_send(fd: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode);extern func __aio_udp_send(fd: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode);
/*
@brief Binds the low-level runtime symbol `__aio_udp_recv`.@briefBinds the low-level runtime symbol `__aio_udp_send`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- dataInput or output data buffer.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::__aio_udp_recv
Signature
extern func __aio_udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode);extern func __aio_udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode);
/*
@brief Binds the low-level runtime symbol `__aio_udp_send_to`.@briefBinds the low-level runtime symbol `__aio_udp_recv`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::__aio_udp_send_to
Signature
extern func __aio_udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode);extern func __aio_udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode);
/*
@brief Binds the low-level runtime symbol `__aio_udp_recv_from`.@briefBinds the low-level runtime symbol `__aio_udp_send_to`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- hostHost name or listen address.
- portPort number.
- dataInput or output data buffer.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::__aio_udp_recv_from
Signature
extern func __aio_udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode);extern func __aio_udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode);
/*
@brief Binds the low-level runtime symbol `__aio_udp_close`.@briefBinds the low-level runtime symbol `__aio_udp_recv_from`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::__aio_udp_close
Signature
extern func __aio_udp_close(fd: Int) -> Void;extern func __aio_udp_close(fd: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__aio_udp_last_peer_host`.@briefBinds the low-level runtime symbol `__aio_udp_close`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnVoid
functionaio.udp::__aio_udp_last_peer_host
Signature
extern func __aio_udp_last_peer_host() -> String;extern func __aio_udp_last_peer_host() -> String;
/*
@brief Binds the low-level runtime symbol `__aio_udp_last_peer_port`.@briefBinds the low-level runtime symbol `__aio_udp_last_peer_host`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `String`.
functionaio.udp::__aio_udp_last_peer_port
Signature
extern func __aio_udp_last_peer_port() -> Int;extern func __aio_udp_last_peer_port() -> Int;
/*
@brief Binds the low-level runtime symbol `__aio_udp_last_peer_clear`.@briefBinds the low-level runtime symbol `__aio_udp_last_peer_port`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionaio.udp::__aio_udp_last_peer_clear
Signature
extern func __aio_udp_last_peer_clear() -> Void;extern func __aio_udp_last_peer_clear() -> Void;
/*@briefBinds the low-level runtime symbol `__aio_udp_last_peer_clear`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnVoid
functionaio.udp::Packet.init
Signature
func init(self: aio.udp.Packet, data: String = "", peer_host: String = "", peer_port: Int = 0) -> Void func init(self: aio.udp.Packet, data: String = "", peer_host: String = "", peer_port: Int = 0) -> Void {
self.data = data;
self.peer_host = peer_host;@briefInitializes a `Packet` instance.
@detailsEstablishes the initial field state for `Packet` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- dataInput or output data buffer.
- peer_hostHost name or address used for the network operation.
- peer_portNetwork port number used for the connection or listener.
@returnVoid
functionaio.udp::Packet.deinit
Signature
func deinit(self: aio.udp.Packet) -> Void func deinit(self: aio.udp.Packet) -> Void {
}
}@briefReleases fallback resources at the end of the `Packet` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionaio.udp::bind
Signature
func bind(host: String, port: Int) -> Int, ErrCodefunc bind(host: String, port: Int) -> Int, ErrCode {
let fd: Int = __aio_udp_bind(host, port);
return fd, aio.error_code_from_int_result(fd);@briefProvides the system library operation `bind`.
@detailsExecutes the `bind` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hostHost name or listen address.
- portPort number.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionaio.udp::connect
Signature
func connect(host: String, port: Int, timeout_ms: Int) -> Future(Int, ErrCode)func connect(host: String, port: Int, timeout_ms: Int) -> Future(Int, ErrCode) {
return __aio_udp_connect(host, port, timeout_ms);
}@briefEstablishes a connection with `connect`.
@detailsExecutes the `connect` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hostHost name or listen address.
- portPort number.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::sock_port
Signature
func sock_port(fd: Int) -> Int, ErrCodefunc sock_port(fd: Int) -> Int, ErrCode {
let p: Int = __aio_udp_sock_port(fd);
return p, aio.error_code_from_int_result(p);@briefProvides the system library operation `sock_port`.
@detailsExecutes the `sock_port` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionaio.udp::send
Signature
func send(fd: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode)func send(fd: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode) {
return __aio_udp_send(fd, data, timeout_ms);
}@briefSends data with `send`.
@detailsExecutes the `send` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- dataInput or output data buffer.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::recv
Signature
func recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode)func recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode) {
return __aio_udp_recv(fd, max_bytes, timeout_ms);
}@briefReceives data with `recv`.
@detailsExecutes the `recv` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::send_to
Signature
func send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode)func send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Future(Int, ErrCode) {
return __aio_udp_send_to(fd, host, port, data, timeout_ms);
}@briefProvides the system library operation `send_to`.
@detailsExecutes the `send_to` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- hostHost name or listen address.
- portPort number.
- dataInput or output data buffer.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::recv_from
Signature
func recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode)func recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> Future(String, ErrCode) {
return __aio_udp_recv_from(fd, max_bytes, timeout_ms);
}@briefProvides the system library operation `recv_from`.
@detailsExecutes the `recv_from` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.udp::close
Signature
func close(fd: Int) -> Voidfunc close(fd: Int) -> Void {
_ = __aio_udp_close(fd);
return;@briefCloses resources and makes later operations unavailable with `close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnVoid
Variables
Class fields (var).
varaio.udp::Packet.data
Type
String@brief`data` field.
@detailsStores the underlying data. The field type is `String`, and it is maintained by the constructors and methods of `Packet`.
var data: String;
/*
@brief `peer_host` field.varaio.udp::Packet.peer_host
Type
String@brief`peer_host` field.
@detailsHolds the `peer_host` value for each `Packet` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var peer_host: String;
/*
@brief `peer_port` field.varaio.udp::Packet.peer_port
Type
Int@brief`peer_port` field.
@detailsHolds the `peer_port` value for each `Packet` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var peer_port: Int;
/*