Static methods

@:value({ reuseAddr : false, ipv6Only : false })staticbind(this:Udp, addr:SockAddr, ipv6Only:Bool = false, reuseAddr:Bool = false):Result<NoData>

Assigns an address to the UDP socket.

staticconnect(this:Udp, addr:SockAddr):Result<ConnectedUdp>

Assigns a peer address to the 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.

staticgetSockName(this:Udp):Result<SockAddr>

Retrieves the address assigned to the UDP socket.

@:value({ recvmmsg : false })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:

staticrecvStop(this:Udp):Result<NoData>

Stops the callback provided to eval.luv.UDP.recvStart.

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.

staticsetBroadcast(this:Udp, value:Bool):Result<NoData>

Sets broadcast.

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.

staticsetMulticastLoop(this:Udp, value:Bool):Result<NoData>

Set multicast loopback.

staticsetMulticastTtl(this:Udp, value:Int):Result<NoData>

Set multicast TTL.

staticsetSourceMembership(this:Udp, group:String, interfaceName:String, source:String, membership:UdpMembership):Result<NoData>

Sets source-specific multicast group membership.

staticsetTtl(this:Udp, value:Int):Result<NoData>

Sets the TTL.

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