A datagram socket can be used to send DatagramPacket's to remote datagram servers and receive DatagramPackets .
Usually you use a datagram socket to send UDP over the wire. UDP is connection-less which means you are not connected to the remote peer in a persistent way. Because of this you have to supply the address and port of the remote peer when sending data.
You can send data to ipv4 or ipv6 addresses, which also include multicast addresses.
Please consult the documentation for more information on datagram sockets.
Anything
no subtypes hierarchy
Initializer |
DatagramSocket(DatagramSocket unknown) |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Methods | |
blockMulticastGroup | shared default DatagramSocket blockMulticastGroup(String multicastAddress, String sourceToBlock, Anything(Throwable|DatagramSocket) handler) Block the given address for the given multicast address and notifies the once the operation completes. Parameters:
|
blockMulticastGroup | shared default DatagramSocket blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock, Anything(Throwable|DatagramSocket) handler) Block the given address for the given multicast address on the given network interface and notifies the once the operation completes. Parameters:
|
close | shared default void close() Closes the DatagramSocket. The close itself is asynchronous. |
close | shared default void close(Anything(Throwable?) handler) Closes the DatagramSocket implementation asynchronous and notifies the handler once done. Parameters:
|
endHandler | shared actual default DatagramSocket endHandler(Anything()? endHandler) Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. Refines ReadStream.endHandler |
exceptionHandler | shared actual default DatagramSocket exceptionHandler(Anything(Throwable)? handler) Set an exception handler. Refines StreamBase.exceptionHandler |
handler | shared actual default DatagramSocket handler(Anything(DatagramPacket)? handler) Set a data handler. As data is read, the handler will be called with the data. Refines ReadStream.handler |
isMetricsEnabled | shared actual default Boolean isMetricsEnabled() Whether the metrics are enabled for this measured object Refines Measured.isMetricsEnabled |
listen | shared default DatagramSocket listen(Integer port, String host, Anything(Throwable|DatagramSocket) handler) Start listening on the given port and host. The handler will be called when the socket is listening. Parameters:
|
listenMulticastGroup | shared default DatagramSocket listenMulticastGroup(String multicastAddress, Anything(Throwable|DatagramSocket) handler) Joins a multicast group and listens for packets send to it. The is notified once the operation completes. Parameters:
|
listenMulticastGroup | shared default DatagramSocket listenMulticastGroup(String multicastAddress, String networkInterface, String? source, Anything(Throwable|DatagramSocket) handler) Joins a multicast group and listens for packets send to it on the given network interface. The is notified once the operation completes. Parameters:
|
localAddress | shared default SocketAddress localAddress() Return the SocketAddress to which this DatagramSocket is bound. |
pause | shared actual default DatagramSocket pause() Pause the Refines ReadStream.pause |
resume | shared actual default DatagramSocket resume() Resume reading. If the Refines ReadStream.resume |
send | shared default DatagramSocket send(Buffer packet, Integer port, String host, Anything(Throwable|DatagramSocket) handler) Write the given Buffer to the SocketAddress. The handler will be notified once the write completes. Parameters:
|
send | shared default DatagramSocket send(String str, Integer port, String host, Anything(Throwable|DatagramSocket) handler) Write the given Parameters:
|
send | shared default DatagramSocket send(String str, String enc, Integer port, String host, Anything(Throwable|DatagramSocket) handler) Write the given Parameters:
|
sender | shared default WriteStream<Buffer> sender(Integer port, String host) Returns a Parameters:
|
unlistenMulticastGroup | shared default DatagramSocket unlistenMulticastGroup(String multicastAddress, Anything(Throwable|DatagramSocket) handler) Leaves a multicast group and stops listening for packets send to it. The is notified once the operation completes. Parameters:
|
unlistenMulticastGroup | shared default DatagramSocket unlistenMulticastGroup(String multicastAddress, String networkInterface, String? source, Anything(Throwable|DatagramSocket) handler) Leaves a multicast group and stops listening for packets send to it on the given network interface. The is notified once the operation completes. Parameters:
|
Inherited Methods |
Methods inherited from: Object equals |
Methods inherited from: Measured |
Methods inherited from: ReadStream<T> |
Methods inherited from: StreamBase |