akka.io

Tcp

object Tcp extends ExtensionId[TcpExt] with ExtensionIdProvider

TCP Extension for Akka’s IO layer.

All contents of the `akka.io` package is marked “experimental”.

This marker signifies that APIs may still change in response to user feedback through-out the 2.2 release cycle. The implementation itself is considered stable and ready for production use.

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

In order to open an outbound connection send a Tcp.Connect message to the TcpExt#manager.

In order to start listening for inbound connetions send a Tcp.Bind message to the TcpExt#manager.

The Java API for generating TCP commands is available at TcpMessage.

Linear Supertypes
Content Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Tcp
  2. ExtensionIdProvider
  3. ExtensionId
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

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

    The Bind message is send to the TCP manager actor, which is obtained via TcpExt#manager in order to bind to a listening socket.

  2. case class Bound(localAddress: InetSocketAddress) extends Event with Product with Serializable

    The sender of a Bind command will—in case of success—receive confirmation in this form.

  3. sealed trait CloseCommand extends Command

    Common interface for all commands which aim to close down an open connection.

  4. trait Command extends Message with HasFailureMessage

    This is the common trait for all commands understood by TCP actors.

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

    Whenever a command cannot be completed, the queried actor will reply with this message, wrapping the original command which failed.

  6. case class CompoundWrite(head: SimpleWriteCommand, tailCommand: WriteCommand) extends WriteCommand with Iterable[SimpleWriteCommand] with Product with Serializable

    A write command which aggregates two other write commands.

  7. case class Connect(remoteAddress: InetSocketAddress, localAddress: Option[InetSocketAddress] = scala.None, options: Traversable[SocketOption] = immutable.this.Nil, timeout: Option[FiniteDuration] = scala.None) extends Command with Product with Serializable

    The Connect message is sent to the TCP manager actor, which is obtained via TcpExt#manager.

  8. case class Connected(remoteAddress: InetSocketAddress, localAddress: InetSocketAddress) extends Event with Product with Serializable

    The connection actor sends this message either to the sender of a Connect command (for outbound) or to the handler for incoming connections designated in the Bind message.

  9. sealed trait ConnectionClosed extends Event

    This is the common interface for all events which indicate that a connection has been closed or half-closed.

  10. case class ErrorClosed(cause: String) extends ConnectionClosed with Product with Serializable

    The connection has been closed due to an IO error.

  11. trait Event extends Message

    Common interface for all events generated by the TCP layer actors.

  12. sealed trait Message extends NoSerializationVerificationNeeded

    The common interface for Command and Event.

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

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

  14. case class Received(data: ByteString) extends Event with Product with Serializable

    Whenever data are read from a socket they will be transferred within this class to the handler actor which was designated in the Register message.

  15. case class Register(handler: ActorRef, keepOpenOnPeerClosed: Boolean = false, useResumeWriting: Boolean = true) extends Command with Product with Serializable

    This message must be sent to a TCP connection actor after receiving the Connected message.

  16. sealed trait SimpleWriteCommand extends WriteCommand

    Common supertype of Write and WriteFile.

  17. sealed trait Unbound extends Event

    The sender of an Unbind command will receive confirmation through this message once the listening socket has been closed.

  18. case class Write(data: ByteString, ack: Event) extends SimpleWriteCommand with Product with Serializable

    Write data to the TCP connection.

  19. sealed trait WriteCommand extends Command

    Common interface for all write commands, currently Write, WriteFile and CompoundWrite.

  20. case class WriteFile(filePath: String, position: Long, count: Long, ack: Event) extends SimpleWriteCommand with Product with Serializable

    Write count bytes starting at position from file at filePath to the connection.

  21. sealed trait WritingResumed extends Event

    When useResumeWriting is in effect as indicated in the Register message, the ResumeWriting command will be acknowledged by this message type, upon which it is safe to send at least one write.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object Abort extends CloseCommand with Product with Serializable

    An abort operation will not flush pending writes and will issue a TCP ABORT command to the O/S kernel which should result in a TCP_RST packet being sent to the peer.

  7. object Aborted extends ConnectionClosed with Product with Serializable

    The connection has been aborted in response to an Abort command.

  8. object Close extends CloseCommand with Product with Serializable

    A normal close operation will first flush pending writes and then close the socket.

  9. object Closed extends ConnectionClosed with Product with Serializable

    The connection has been closed normally in response to a Close command.

  10. object ConfirmedClose extends CloseCommand with Product with Serializable

    A confirmed close operation will flush pending writes and half-close the connection, waiting for the peer to close the other half.

  11. object ConfirmedClosed extends ConnectionClosed with Product with Serializable

    The connection has been half-closed by us and then half-close by the peer in response to a ConfirmedClose command.

  12. object NoAck extends NoAck

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

  13. object PeerClosed extends ConnectionClosed with Product with Serializable

    The peer has closed its writing half of the connection.

  14. object ResumeReading extends Command with Product with Serializable

    This command needs to be sent to the connection actor after a SuspendReading command in order to resume reading from the socket.

  15. object ResumeWriting extends Command with Product with Serializable

    When useResumeWriting is in effect as was indicated in the Register message then this command needs to be sent to the connection actor in order to re-enable writing after a CommandFailed event.

  16. object SO extends SoForwarders

    Scala API: this object contains all applicable socket options for TCP.

  17. object SuspendReading extends Command with Product with Serializable

    Sending this command to the connection actor will disable reading from the TCP socket.

  18. object Unbind extends Command with Product with Serializable

    In order to close down a listening socket, send this message to that socket’s actor (that is the actor which previously had sent the Bound message).

  19. object Unbound extends Unbound with Product with Serializable

  20. object Write extends Serializable

  21. object WriteCommand

  22. object WritingResumed extends WritingResumed with Product with Serializable

  23. def apply(system: ActorSystem): TcpExt

    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
  24. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  25. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. def createExtension(system: ExtendedActorSystem): TcpExt

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

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

    Definition Classes
    TcpExtensionId
  27. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def equals(other: Any): Boolean

    Definition Classes
    ExtensionId → AnyRef → Any
  29. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. def get(system: ActorSystem): TcpExt

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

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

    Definition Classes
    TcpExtensionId
  31. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  32. final def hashCode(): Int

    Definition Classes
    ExtensionId → AnyRef → Any
  33. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  34. def lookup(): Tcp.type

    Returns the canonical ExtensionId for this Extension

    Returns the canonical ExtensionId for this Extension

    Definition Classes
    TcpExtensionIdProvider
  35. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  39. def toString(): String

    Definition Classes
    AnyRef → Any
  40. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ExtensionIdProvider

Inherited from ExtensionId[TcpExt]

Inherited from AnyRef

Inherited from Any

Ungrouped