Variables

messageSignal:Signal<UdpMessage>

Emitted when a message is received by this socket. See UdpMessage.

read onlyremoteAddress:Null<SocketAddress>

Remote address and port that this socket is connected to. See connect.

Methods

addMembership (multicastAddress:String, ?multicastInterface:String):Void

Joins the given multicast group.

bind (?address:Address, ?port:Int):Void

Binds this socket to a local address and port. Packets sent to the bound address will arrive via messageSignal. Outgoing packets will be sent from the given address and port. If any packet is sent without calling bind first, an address and port is chosen automatically by the system - it can be obtained with localAddress.

close (?cb:Callback<NoData>):Void

Closes this socket and all underlying resources.

connect (?address:Address, port:Int):Void

Connects this socket to a remote address and port. Any send calls after connect is called must not specify address nor port, they will automatically use the ones specified in the connect call.

disconnect ():Void

Clears any remote address and port previously set with connect.

dropMembership (multicastAddress:String, ?multicastInterface:String):Void

Leaves the given multicast group.

ref ():Void

send (msg:Bytes, offset:Int, length:Int, ?address:Address, ?port:Int, ?callback:Callback<NoData>):Void

Sends a message.

Parameters:

msg

Buffer from which to read the message data.

offset

Position in msg at which to start reading.

length

Length of message in bytes.

address

Address to send the message to. Must be null if this socket is connected.

port

Port to send the message to. Must be null if this socket is connected.

setBroadcast (flag:Bool):Void

Sets broadcast on or off.

setMulticastInterface (multicastInterface:String):Void

Sets the multicast interface on which to send and receive data.

setMulticastLoopback (flag:Bool):Void

Set IP multicast loopback on or off. Makes multicast packets loop back to local sockets.

setMulticastTTL (ttl:Int):Void

Sets the multicast TTL (time-to-live).

setTTL (ttl:Int):Void

Sets the TTL (time-to-live) for outgoing packets.

Parameters:

ttl

Number of hops.

unref ():Void

Static methods

staticcreate (type:IpFamily, ?options:UdpSocketOptions, ?listener:Listener<UdpMessage>):UdpSocket