AsyncDatagramChannel

abstract class AsyncDatagramChannel extends AutoCloseable

An asynchronous channel for reading, writing, and manipulating an UDP socket.

On the JVM this is a wrapper around java.nio.channels.DatagramChannel

Companion
object
trait AutoCloseable
class Object
trait Matchable
class Any

Value members

Abstract methods

def bind(local: InetSocketAddress): Unit

Binds the channel's socket to a local address

Binds the channel's socket to a local address

Value Params
local

the local address to bind the socket, or null to bind to an automatically assigned socket address

def localAddress(): Option[InetSocketAddress]

Asks the socket address that this channel's socket is bound to

Asks the socket address that this channel's socket is bound to

def receive(maxSize: Int, timeout: FiniteDuration): Option[Packet]

Receives a packet via this channel. If a datagram is not available after the timeout then this method returns scala.None.

Receives a packet via this channel. If a datagram is not available after the timeout then this method returns scala.None.

Value Params
maxSize

if the value is smaller than the size required to hold the datagram, then the remainder of the datagram is silently discarded.

timeout

the receive timeout

Returns

the packet, or scala.None if no datagram was available before timeout

def send(packet: Packet): Int

Sends a datagram via this channel

Sends a datagram via this channel

Value Params
packet

the packet to be sent

Inherited methods

@throws(java.lang.Exception)
def close(): Unit
Inherited from
AutoCloseable