EgretDoc
Back to Home
Location:system/net.udp

Module

Module documentation.

modulenet.udp

Classes

Classes and inheritance.

classnet.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.

functionnet.udp::__udp_bind
Signatureextern func __udp_bind(host: String, port: Int) -> Int;
extern func __udp_bind(host: String, port: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_connect`.
@briefBinds the low-level runtime symbol `__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`.
functionnet.udp::__udp_connect
Signatureextern func __udp_connect(host: String, port: Int, timeout_ms: Int) -> Int;
extern func __udp_connect(host: String, port: Int, timeout_ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_sock_port`.
@briefBinds the low-level runtime symbol `__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.
@returnReturns the operation result as `Int`.
functionnet.udp::__udp_sock_port
Signatureextern func __udp_sock_port(fd: Int) -> Int;
extern func __udp_sock_port(fd: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_set_buffer_sizes`.
@briefBinds the low-level runtime symbol `__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`.
functionnet.udp::__udp_set_buffer_sizes
Signatureextern func __udp_set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> Int;
extern func __udp_set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_send`.
@briefBinds the low-level runtime symbol `__udp_set_buffer_sizes`.
@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.
  • recv_bytesSize or length value that limits how much data the operation processes.
  • send_bytesSize or length value that limits how much data the operation processes.
@returnReturns the operation result as `Int`.
functionnet.udp::__udp_send
Signatureextern func __udp_send(fd: Int, data: String, timeout_ms: Int) -> Int;
extern func __udp_send(fd: Int, data: String, timeout_ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_recv`.
@briefBinds the low-level runtime symbol `__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.
@returnReturns the operation result as `Int`.
functionnet.udp::__udp_recv
Signatureextern func __udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> String;
extern func __udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__udp_send_to`.
@briefBinds the low-level runtime symbol `__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.
@returnReturns the operation result as `String`.
functionnet.udp::__udp_send_to
Signatureextern func __udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Int;
extern func __udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_recv_from`.
@briefBinds the low-level runtime symbol `__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.
@returnReturns the operation result as `Int`.
functionnet.udp::__udp_recv_from
Signatureextern func __udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> String;
extern func __udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__udp_close`.
@briefBinds the low-level runtime symbol `__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.
@returnReturns the operation result as `String`.
functionnet.udp::__udp_close
Signatureextern func __udp_close(fd: Int) -> Void;
extern func __udp_close(fd: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__udp_last_peer_host`.
@briefBinds the low-level runtime symbol `__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
functionnet.udp::__udp_last_peer_host
Signatureextern func __udp_last_peer_host() -> String;
extern func __udp_last_peer_host() -> String;
/*
@brief Binds the low-level runtime symbol `__udp_last_peer_port`.
@briefBinds the low-level runtime symbol `__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`.
functionnet.udp::__udp_last_peer_port
Signatureextern func __udp_last_peer_port() -> Int;
extern func __udp_last_peer_port() -> Int;
/*
@brief Binds the low-level runtime symbol `__udp_last_peer_clear`.
@briefBinds the low-level runtime symbol `__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`.
functionnet.udp::__udp_last_peer_clear
Signatureextern func __udp_last_peer_clear() -> Void;
extern func __udp_last_peer_clear() -> Void;

/*
@briefBinds the low-level runtime symbol `__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
functionnet.udp::udp_bind
Signaturefunc udp_bind(host: String, port: Int) -> Int
func udp_bind(host: String, port: Int) -> Int {
    return __udp_bind(host, port);
}
@briefProvides the system library operation `udp_bind`.
@detailsExecutes the `udp_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 the operation result as `Int`.
functionnet.udp::udp_connect
Signaturefunc udp_connect(host: String, port: Int, timeout_ms: Int) -> Int
func udp_connect(host: String, port: Int, timeout_ms: Int) -> Int {
    return __udp_connect(host, port, timeout_ms);
}
@briefProvides the system library operation `udp_connect`.
@detailsExecutes the `udp_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.
@returnReturns the operation result as `Int`.
functionnet.udp::udp_sock_port
Signaturefunc udp_sock_port(fd: Int) -> Int
func udp_sock_port(fd: Int) -> Int {
    return __udp_sock_port(fd);
}
@briefProvides the system library operation `udp_sock_port`.
@detailsExecutes the `udp_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 the operation result as `Int`.
functionnet.udp::udp_set_buffer_sizes
Signaturefunc udp_set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> Int
func udp_set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> Int {
    return __udp_set_buffer_sizes(fd, recv_bytes, send_bytes);
}
@briefProvides the system library operation `udp_set_buffer_sizes`.
@detailsExecutes the `udp_set_buffer_sizes` 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.
  • recv_bytesSize or length value that limits how much data the operation processes.
  • send_bytesSize or length value that limits how much data the operation processes.
@returnReturns the operation result as `Int`.
functionnet.udp::udp_send
Signaturefunc udp_send(fd: Int, data: String, timeout_ms: Int) -> Int
func udp_send(fd: Int, data: String, timeout_ms: Int) -> Int {
    return __udp_send(fd, data, timeout_ms);
}
@briefProvides the system library operation `udp_send`.
@detailsExecutes the `udp_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.
@returnReturns the operation result as `Int`.
functionnet.udp::udp_recv
Signaturefunc udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> String
func udp_recv(fd: Int, max_bytes: Int, timeout_ms: Int) -> String {
    return __udp_recv(fd, max_bytes, timeout_ms);
}
@briefProvides the system library operation `udp_recv`.
@detailsExecutes the `udp_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.
@returnReturns the operation result as `String`.
functionnet.udp::udp_send_to
Signaturefunc udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Int
func udp_send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int) -> Int {
    return __udp_send_to(fd, host, port, data, timeout_ms);
}
@briefProvides the system library operation `udp_send_to`.
@detailsExecutes the `udp_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.
@returnReturns the operation result as `Int`.
functionnet.udp::udp_recv_from
Signaturefunc udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> String
func udp_recv_from(fd: Int, max_bytes: Int, timeout_ms: Int) -> String {
    return __udp_recv_from(fd, max_bytes, timeout_ms);
}
@briefProvides the system library operation `udp_recv_from`.
@detailsExecutes the `udp_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.
@returnReturns the operation result as `String`.
functionnet.udp::udp_close
Signaturefunc udp_close(fd: Int) -> Void
func udp_close(fd: Int) -> Void {
    _ = __udp_close(fd);
}
@briefProvides the system library operation `udp_close`.
@detailsExecutes the `udp_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
functionnet.udp::Packet.init
Signaturefunc init(self: net.udp.Packet, data: String = "", peer_host: String = "", peer_port: Int = 0) -> Void
    func init(self: net.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
functionnet.udp::Packet.deinit
Signaturefunc deinit(self: net.udp.Packet) -> Void
    func deinit(self: net.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
functionnet.udp::bind
Signaturefunc bind(host: String, port: Int) -> Int, ErrCode
func bind(host: String, port: Int) -> Int, ErrCode {
    _ = net.clear_last_error();
    let fd: Int = __udp_bind(host, port);
@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.
functionnet.udp::connect
Signaturefunc connect(host: String, port: Int, timeout_ms: Int = -1) -> Int, ErrCode
func connect(host: String, port: Int, timeout_ms: Int = -1) -> Int, ErrCode {
    _ = net.clear_last_error();
    let fd: Int = __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.
@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.
functionnet.udp::sock_port
Signaturefunc sock_port(fd: Int) -> Int, ErrCode
func sock_port(fd: Int) -> Int, ErrCode {
    let p: Int = __udp_sock_port(fd);
    if p > 0 {
@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.
functionnet.udp::set_nonblock
Signaturefunc set_nonblock(fd: Int) -> ErrCode
func set_nonblock(fd: Int) -> ErrCode {
    return net.set_nonblock(fd);
}
@briefSets state or configuration with `set_nonblock`.
@detailsExecutes the `set_nonblock` 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 `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.
functionnet.udp::set_buffer_sizes
Signaturefunc set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> ErrCode
func set_buffer_sizes(fd: Int, recv_bytes: Int, send_bytes: Int) -> ErrCode {
    _ = net.clear_last_error();
    let rc: Int = __udp_set_buffer_sizes(fd, recv_bytes, send_bytes);
@briefSets state or configuration with `set_buffer_sizes`.
@detailsExecutes the `set_buffer_sizes` 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.
  • recv_bytesSize or length value that limits how much data the operation processes.
  • send_bytesSize or length value that limits how much data the operation processes.
@returnReturns `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.
functionnet.udp::send
Signaturefunc send(fd: Int, data: String, timeout_ms: Int = -1) -> Int, ErrCode
func send(fd: Int, data: String, timeout_ms: Int = -1) -> Int, ErrCode {
    _ = net.clear_last_error();
    let n: Int = __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.
@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.
functionnet.udp::recv
Signaturefunc recv(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> String, ErrCode
func recv(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> String, ErrCode {
    _ = net.clear_last_error();
    let s: String = __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.
@returnReturns `String, 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.
functionnet.udp::send_to
Signaturefunc send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int = -1) -> Int, ErrCode
func send_to(fd: Int, host: String, port: Int, data: String, timeout_ms: Int = -1) -> Int, ErrCode {
    _ = net.clear_last_error();
    let n: Int = __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.
@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.
functionnet.udp::recv_from
Signaturefunc recv_from(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> String, ErrCode
func recv_from(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> String, ErrCode {
    _ = net.clear_last_error();
    let s: String = __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.
@returnReturns `String, 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.
functionnet.udp::recv_from_packet
Signaturefunc recv_from_packet(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> net.udp.Packet, ErrCode
func recv_from_packet(fd: Int, max_bytes: Int, timeout_ms: Int = -1) -> net.udp.Packet, ErrCode {
    _ = net.clear_last_error();
    _ = __udp_last_peer_clear();
@briefProvides the system library operation `recv_from_packet`.
@detailsExecutes the `recv_from_packet` 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.
@returnReturns `net.udp.Packet, 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.
functionnet.udp::close
Signaturefunc close(fd: Int) -> Void
func close(fd: Int) -> Void {
    _ = __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).

varnet.udp::Packet.data
TypeString
@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.
varnet.udp::Packet.peer_host
TypeString
@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.
varnet.udp::Packet.peer_port
TypeInt
@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;

    /*