object Udp extends ExtensionId[UdpExt] with ExtensionIdProvider

UDP Extension for Akka’s IO layer.

This extension implements the connectionless UDP protocol without calling connect on the underlying sockets, i.e. without restricting from whom data can be received. For “connected” UDP mode see UdpConnected.

For a full description of the design and philosophy behind this IO implementation please refer to the Pekko online documentation.

The Java API for generating UDP commands is available at UdpMessage.

Annotations
@ccompatUsedUntil213()
Source
Udp.scala
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Udp
  2. ExtensionIdProvider
  3. ExtensionId
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final case class Bind(handler: ActorRef, localAddress: InetSocketAddress, options: Traversable[SocketOption] = Nil) extends Command with Product with Serializable

    Send this message to the UdpExt#manager in order to bind to the given local port (or an automatically assigned one if the port number is zero).

    Send this message to the UdpExt#manager in order to bind to the given local port (or an automatically assigned one if the port number is zero). The listener actor for the newly bound port will reply with a Bound message, or the manager will reply with a CommandFailed message.

    Annotations
    @nowarn()
  2. final case class Bound(localAddress: InetSocketAddress) extends Event with Product with Serializable

    This message is sent by the listener actor in response to a Bind command.

    This message is sent by the listener actor in response to a Bind command. If the address to bind to specified a port number of zero, then this message can be inspected to find out which port was automatically assigned.

  3. trait Command extends HasFailureMessage with Message

    The common type of all commands supported by the UDP implementation.

  4. final case class CommandFailed(cmd: Command) extends Event with Product with Serializable

    When a command fails it will be replied to with this message type, wrapping the failing command object.

  5. trait Event extends Message

    The common type of all events emitted by the UDP implementation.

  6. sealed trait Message extends AnyRef

    The common interface for Command and Event.

  7. case class NoAck(token: Any) extends Event with Product with Serializable

    Each Send can optionally request a positive acknowledgment to be sent to the commanding actor.

    Each Send can optionally request a positive acknowledgment to be sent to the commanding actor. If such notification is not desired the Send#ack must be set to an instance of this class. The token contained within can be used to recognize which write failed when receiving a CommandFailed message.

  8. final case class Received(data: ByteString, sender: InetSocketAddress) extends Event with Product with Serializable

    When a listener actor receives a datagram from its socket it will send it to the handler designated in the Bind message using this message type.

  9. final case class Send(payload: ByteString, target: InetSocketAddress, ack: Event) extends Command with Product with Serializable

    This message is understood by the “simple sender” which can be obtained by sending the SimpleSender query to the UdpExt#manager as well as by the listener actors which are created in response to Bind.

    This message is understood by the “simple sender” which can be obtained by sending the SimpleSender query to the UdpExt#manager as well as by the listener actors which are created in response to Bind. It will send the given payload data as one UDP datagram to the given target address. The UDP actor will respond with CommandFailed if the send could not be enqueued to the O/S kernel because the send buffer was full. If the given ack is not of type NoAck the UDP actor will reply with the given object as soon as the datagram has been successfully enqueued to the O/S kernel.

    The sending UDP socket’s address belongs to the “simple sender” which does not handle inbound datagrams and sends from an ephemeral port; therefore sending using this mechanism is not suitable if replies are expected, use Bind in that case.

  10. case class SimpleSender(options: Traversable[SocketOption] = Nil) extends Command with Product with Serializable

    Retrieve a reference to a “simple sender” actor of the UDP extension.

    Retrieve a reference to a “simple sender” actor of the UDP extension. The newly created “simple sender” will reply with the SimpleSenderReady notification.

    The “simple sender” is a convenient service for being able to send datagrams when the originating address is meaningless, i.e. when no reply is expected.

    The “simple sender” will not stop itself, you will have to send it a pekko.actor.PoisonPill when you want to close the socket.

    Annotations
    @nowarn()
  11. sealed trait SimpleSenderReady extends Event

    The “simple sender” sends this message type in response to a SimpleSender query.

  12. sealed trait Unbound extends AnyRef

    This message is sent by the listener actor in response to an Unbind command after the socket has been closed.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(system: ClassicActorSystemProvider): UdpExt

    Returns an instance of the extension identified by this ExtensionId instance.

    Returns an instance of the extension identified by this ExtensionId instance.

    Definition Classes
    ExtensionId
  5. def apply(system: ActorSystem): UdpExt

    Returns an instance of the extension identified by this ExtensionId instance.

    Returns an instance of the extension identified by this ExtensionId instance.

    Definition Classes
    ExtensionId
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  8. def createExtension(system: ExtendedActorSystem): UdpExt

    Is used by Pekko to instantiate the Extension identified by this ExtensionId, internal use only.

    Is used by Pekko to instantiate the Extension identified by this ExtensionId, internal use only.

    Definition Classes
    UdpExtensionId
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. final def equals(other: Any): Boolean
    Definition Classes
    ExtensionId → AnyRef → Any
  11. def get(system: ClassicActorSystemProvider): UdpExt

    Returns an instance of the extension identified by this ExtensionId instance.

    Returns an instance of the extension identified by this ExtensionId instance. Java API For extensions written in Scala that are to be used from Java also, this method should be overridden to get correct return type.

    override def get(system: ClassicActorSystemProvider): TheExtension = super.get(system)
    Definition Classes
    UdpExtensionId
  12. def get(system: ActorSystem): UdpExt

    Java API: retrieve the Udp extension for the given system.

    Java API: retrieve the Udp extension for the given system.

    Definition Classes
    UdpExtensionId
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  14. final def hashCode(): Int
    Definition Classes
    ExtensionId → AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def lookup: Udp

    Returns the canonical ExtensionId for this Extension

    Returns the canonical ExtensionId for this Extension

    Definition Classes
    UdpExtensionIdProvider
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. object NoAck extends NoAck

    Default NoAck instance which is used when no acknowledgment information is explicitly provided.

    Default NoAck instance which is used when no acknowledgment information is explicitly provided. Its “token” is null.

  26. case object ResumeReading extends Command with Product with Serializable

    This message must be sent to the listener actor to re-enable reading from the socket after a SuspendReading command.

  27. object SO extends SoForwarders

    Scala API: This object provides access to all socket options applicable to UDP sockets.

    Scala API: This object provides access to all socket options applicable to UDP sockets.

    For the Java API see UdpSO.

  28. object Send extends Serializable
  29. object SimpleSender extends SimpleSender
  30. case object SimpleSenderReady extends SimpleSenderReady with Product with Serializable
  31. case object SuspendReading extends Command with Product with Serializable

    Send this message to a listener actor (which sent a Bound message) to have it stop reading datagrams from the network.

    Send this message to a listener actor (which sent a Bound message) to have it stop reading datagrams from the network. If the O/S kernel’s receive buffer runs full then subsequent datagrams will be silently discarded. Re-enable reading from the socket using the ResumeReading command.

  32. case object Unbind extends Command with Product with Serializable

    Send this message to the listener actor that previously sent a Bound message in order to close the listening socket.

    Send this message to the listener actor that previously sent a Bound message in order to close the listening socket. The recipient will reply with an Unbound message.

  33. case object Unbound extends Unbound with Product with Serializable

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from ExtensionIdProvider

Inherited from ExtensionId[UdpExt]

Inherited from AnyRef

Inherited from Any

Ungrouped