Static methods
staticbind(this:Udp, addr:SockAddr, ipv6Only:Bool = false, reuseAddr:Bool = false):Result<NoData>
Assigns an address to the UDP socket.
staticgetSendQueueCount(this:Udp):Int
Number of send requests currently in the queue awaiting to be processed.
staticgetSendQueueSize(this:Udp):Int
Number of bytes queued for sending. This field strictly shows how much information is currently queued.
staticinit(loop:Loop, ?domain:AddressFamily, recvmmsg:Bool = false):Result<Udp>
Allocates and initializes a UDP socket.
The handle should be cleaned up with eval.luv.Handle.close
when no longer needed.
staticrecvStart(this:Udp, callback:(result:Result<{flags:Array<RecvFlag>, data:Buffer, addr:Option<SockAddr>}>, allocate:(size:Int) ‑> Buffer) ‑> Void):Void
Calls callback
whenever a datagram is received on the UDP socket.
See also:
staticsend(this:Udp, data:Array<Buffer>, addr:SockAddr, callback:(result:Result<NoData>) ‑> Void):Void
Sends a datagram.
For connected UDP sockets, see eval.luv.UDP.Connected.send
.
staticsetMembership(this:Udp, group:String, interfaceName:String, membership:UdpMembership):Result<NoData>
Sets multicast group membership.
staticsetMulticastInterface(this:Udp, value:Int):Result<NoData>
Sets the interface to be used for multicast.
staticsetSourceMembership(this:Udp, group:String, interfaceName:String, source:String, membership:UdpMembership):Result<NoData>
Sets source-specific multicast group membership.
statictrySend(this:Udp, data:Array<Buffer>, addr:SockAddr):Result<NoData>
Like eval.luv.UDP.send
, but only attempts to send the datagram immediately.
staticusingRecvmmsg(this:Udp):Bool
Evaluates to true if and only if the UDP was created with recvmmsg = true
and the platform supports recvmmsg(2).