Udp
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.
Attributes
Members list
Type members
Classlikes
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.
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.
Attributes
- Source
- Udp.scala
- Supertypes
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.
The common type of all commands supported by the UDP implementation.
The common type of all commands supported by the UDP implementation.
Attributes
- Source
- Udp.scala
- Supertypes
- Known subtypes
-
class Bindobject ResumeReadingclass Sendclass SimpleSenderobject SimpleSenderobject SuspendReadingobject UnbindShow all
When a command fails it will be replied to with this message type, wrapping the failing command object.
The common type of all events emitted by the UDP implementation.
The common type of all events emitted by the UDP implementation.
Attributes
- Source
- Udp.scala
- Supertypes
- Known subtypes
-
class Boundclass CommandFailedclass NoAckobject NoAckclass Receivedtrait SimpleSenderReadyobject SimpleSenderReadyShow all
Attributes
- Source
- Udp.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Commandclass Bindobject ResumeReadingclass Sendclass SimpleSenderobject SimpleSenderobject SuspendReadingobject Unbindtrait Eventclass Boundclass CommandFailedclass NoAckobject NoAckclass Receivedtrait SimpleSenderReadyobject SimpleSenderReadyShow all
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.
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.
Attributes
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.
This message must be sent to the listener actor to re-enable reading from the socket after a SuspendReading command.
This message must be sent to the listener actor to re-enable reading from the socket after a SuspendReading command.
Attributes
- Source
- Udp.scala
- Supertypes
- Self type
-
ResumeReading.type
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.
Attributes
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.
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.
Attributes
Retrieve a reference to a “simple sender” actor of the UDP extension. The newly created “simple sender” will reply with the SimpleSenderReady notification.
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.
Attributes
- Companion
- object
- Source
- Udp.scala
- Supertypes
- Known subtypes
-
object SimpleSender
Attributes
- Companion
- class
- Source
- Udp.scala
- Supertypes
- Self type
-
SimpleSender.type
The “simple sender” sends this message type in response to a SimpleSender query.
The “simple sender” sends this message type in response to a SimpleSender query.
Attributes
- Companion
- object
- Source
- Udp.scala
- Supertypes
- Known subtypes
-
object SimpleSenderReady
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.
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.
Attributes
- Source
- Udp.scala
- Supertypes
- Self type
-
SuspendReading.type
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.
This message is sent by the listener actor in response to an Unbind command after the socket has been closed.
Value members
Concrete methods
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.
Attributes
- Definition Classes
- Source
- Udp.scala
Java API: retrieve the Udp extension for the given system.
Java API: retrieve the Udp extension for the given system.
Attributes
- Definition Classes
- Source
- Udp.scala
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.
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)
Attributes
- Definition Classes
- Source
- Udp.scala
Returns the canonical ExtensionId for this Extension
Inherited methods
Returns an instance of the extension identified by this ExtensionId instance.
Returns an instance of the extension identified by this ExtensionId instance.
Attributes
- Inherited from:
- ExtensionId
- Source
- Extension.scala
Returns an instance of the extension identified by this ExtensionId instance.
Returns an instance of the extension identified by this ExtensionId instance.
Attributes
- Inherited from:
- ExtensionId
- Source
- Extension.scala
Compares the receiver object (this) with the argument object (that) for equivalence.
Compares the receiver object (this) with the argument object (that) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
xof typeAny,x.equals(x)should returntrue. - It is symmetric: for any instances
xandyof typeAny,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any instances
x,y, andzof typeAnyifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
trueif the receiver object is equivalent to the argument;falseotherwise. - Definition Classes
-
ExtensionId -> Any
- Inherited from:
- ExtensionId
- Source
- Extension.scala
Calculates a hash code value for the object.
Calculates a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
ExtensionId -> Any
- Inherited from:
- ExtensionId
- Source
- Extension.scala