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`
  - `Object`
    - `Basic` ...and other supertypes
      - `DatagramSocket` ...and other supertypes

- `DatagramSocket`
  - `Basic`
    - `Identifiable`
    - `Object`
      - `Anything`
  - `Measured`
  - `ReadStream`
    - `StreamBase`

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: `multicastAddress` the address for which you want to block the source address `sourceToBlock` the source address which should be blocked. You will not receive an multicast packets for it anymore. `handler` the handler to notify once the operation completes
`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: `multicastAddress` the address for which you want to block the source address `networkInterface` the network interface on which the blocking should occur. `sourceToBlock` the source address which should be blocked. You will not receive an multicast packets for it anymore. `handler` the handler to notify once the operation completes
`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: `handler` the handler to notify once complete
`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: `port` the port to listen on `host` the host to listen on `handler` the handler will be called when listening
`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: `multicastAddress` the address of the multicast group to join `handler` then handler to notify once the operation completes
`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: `multicastAddress` the address of the multicast group to join `networkInterface` the network interface on which to listen for packets. `source` the address of the source for which we will listen for multicast packets `handler` then handler to notify once the operation completes
`localAddress` | `shared default SocketAddress localAddress()` Return the SocketAddress to which this DatagramSocket is bound.
`pause` | `shared actual default DatagramSocket pause()` Pause the `ReadSupport`. While it's paused, no data will be sent to the `dataHandler` Refines `ReadStream.pause`
`resume` | `shared actual default DatagramSocket resume()` Resume reading. If the `ReadSupport` has been paused, reading will recommence on it. 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: `packet` the Buffer to write `port` the host port of the remote peer `host` the host address of the remote peer `handler` the handler to notify once the write completes.
`send` | `shared default DatagramSocket send(String str, Integer port, String host, Anything(Throwable|DatagramSocket) handler)` Write the given `String` to the SocketAddress using UTF8 encoding. The will be notified once the write completes. Parameters: `str` the `String` to write `port` the host port of the remote peer `host` the host address of the remote peer `handler` the handler to notify once the write completes.
`send` | `shared default DatagramSocket send(String str, String enc, Integer port, String host, Anything(Throwable|DatagramSocket) handler)` Write the given `String` to the SocketAddress using the given encoding. The will be notified once the write completes. Parameters: `str` the `String` to write `enc` the charset used for encoding `port` the host port of the remote peer `host` the host address of the remote peer `handler` the handler to notify once the write completes.
`sender` | `shared default PacketWritestream sender(Integer port, String host)` Returns a PacketWritestream able to send to the SocketAddress. Parameters: `port` the port of the remote peer `host` the host address of the remote peer
`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: `multicastAddress` the address of the multicast group to leave `handler` then handler to notify once the operation completes
`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: `multicastAddress` the address of the multicast group to join `networkInterface` the network interface on which to listen for packets. `source` the address of the source for which we will listen for multicast packets `handler` the handler to notify once the operation completes

Inherited Methods
Methods inherited from: `Object` `equals`
Methods inherited from: `Measured` `isMetricsEnabled()`
Methods inherited from: `ReadStream<T>` `endHandler()`, `exceptionHandler()`, `handler()`, `pause()`, `resume()`
Methods inherited from: `StreamBase` `exceptionHandler()`