Expand description
Node dgram module: real UDP sockets over std::net::UdpSocket.
Threading model mirrors net (see host::run_event_loop): each bound socket
runs a recv_from loop on its own thread. That thread NEVER touches the JS
heap — it only moves raw datagram bytes and posts IoTask closures onto the
host channel. Every JS-visible effect (emitting message/listening/close,
running callbacks) happens on the main thread when the event loop runs the
posted closure. The UdpSocket is shared with the recv thread through an
Arc (both recv_from and send_to take &self). All main-thread records
live in a thread_local, so they need no locking of their own.
Constants§
- MODULE_
METHODS dgrammodule functions routed throughstdlib::call.- SOCKET_
METHODS - Instance methods on a
dgram.Socket(forinstance_has_method/ dispatch). - SOCKET_
TAG - The
dgram.Socket@@nativetag.
Functions§
- call
stdlib::callentry fordgram.<method>.- create_
socket dgram.createSocket(type[, callback])ordgram.createSocket(options[, callback]).typeis'udp4'/'udp6'; an options object reads its.type. Acallbackis registered as a one-time-per-emit'message'listener (Node semantics).- instance_
call