Static methods

@:noExpr@: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.

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

Assigns a peer address to the socket.

@:noExprstaticgetSendQueueCount(this:Udp):Int

Number of send requests currently in the queue awaiting to be processed.

@:noExprstaticgetSendQueueSize(this:Udp):Int

Number of bytes queued for sending. This field strictly shows how much information is currently queued.

@:noExprstaticgetSockName(this:Udp):Result<SockAddr>

Retrieves the address assigned to the UDP socket.

@:noExpr@: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.

@:noExprstaticrecvStart(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:

@:noExprstaticrecvStop(this:Udp):Result<NoData>

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

@:noExprstaticsend(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.

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

Sets broadcast.

@:noExprstaticsetMembership(this:Udp, group:String, interfaceName:String, membership:UdpMembership):Result<NoData>

Sets multicast group membership.

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

Sets the interface to be used for multicast.

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

Set multicast loopback.

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

Set multicast TTL.

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

Sets source-specific multicast group membership.

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

Sets the TTL.

@:noExprstatictrySend(this:Udp, data:Array<Buffer>, addr:SockAddr):Result<NoData>

Like eval.luv.UDP.send, but only attempts to send the datagram immediately.

@:noExprstaticusingRecvmmsg(this:Udp):Bool

Evaluates to true if and only if the UDP was created with recvmmsg = true and the platform supports recvmmsg(2).