The Bind message is send to the TCP manager actor, which is obtained via TcpExt#manager in order to bind to a listening socket.
The Bind message is send to the TCP manager actor, which is obtained via TcpExt#manager in order to bind to a listening socket. The manager replies either with a CommandFailed or the actor handling the listen socket replies with a Bound message. If the local port is set to 0 in the Bind message, then the Bound message should be inspected to find the actual port which was bound to.
The actor which will receive all incoming connection requests in the form of Connected messages.
The socket address to bind to; use port zero for automatic assignment (i.e. an ephemeral port, see Bound)
This specifies the number of unaccepted connections the O/S kernel will hold for this port before refusing connections.
Please refer to the Tcp.SO
object for a list of all supported options.
The sender of a Bind command will—in case of success—receive confirmation in this form.
The sender of a Bind command will—in case of success—receive confirmation
in this form. If the bind address indicated a 0 port number, then the contained
localAddress
can be used to find out which port was automatically assigned.
Common interface for all commands which aim to close down an open connection.
This is the common trait for all commands understood by TCP actors.
Whenever a command cannot be completed, the queried actor will reply with this message, wrapping the original command which failed.
A write command which aggregates two other write commands.
A write command which aggregates two other write commands. Using this construct
you can chain a number of Write and/or WriteFile commands together in a way
that allows them to be handled as a single write which gets written out to the
network as quickly as possible.
If the sub commands contain ack
requests they will be honored as soon as the
respective write has been written completely.
The Connect message is sent to the TCP manager actor, which is obtained via TcpExt#manager.
The Connect message is sent to the TCP manager actor, which is obtained via TcpExt#manager. Either the manager replies with a CommandFailed or the actor handling the new connection replies with a Connected message.
is the address to connect to
optionally specifies a specific address to bind to
Please refer to the Tcp.SO
object for a list of all supported options.
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.
This is the common interface for all events which indicate that a connection has been closed or half-closed.
The connection has been closed due to an IO error.
Common interface for all events generated by the TCP layer actors.
Each WriteCommand can optionally request a positive acknowledgment to be sent to the commanding actor.
Each WriteCommand can optionally request a positive acknowledgment to be sent to the commanding actor. If such notification is not desired the SimpleWriteCommand#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.
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.
This message must be sent to a TCP connection actor after receiving the Connected message.
This message must be sent to a TCP connection actor after receiving the Connected message. The connection will not read any data from the socket until this message is received, because this message defines the actor which will receive all inbound data.
The actor which will receive all incoming data and which will be informed when the connection is closed.
If this is set to true then the connection is not automatically closed when the peer closes its half, requiring an explicit CloseCommand from our side when finished.
If this is set to true then the connection actor
will refuse all further writes after issuing a CommandFailed
notification until ResumeWriting
is received. This can
be used to implement NACK-based write backpressure.
This message enables the accepting of the next connection if read throttling is enabled for connection actors.
This message enables the accepting of the next connection if read throttling is enabled for connection actors.
The number of connections to accept before waiting for the next resume command
The sender of an Unbind
command will receive confirmation through this
message once the listening socket has been closed.
Write data to the TCP connection.
Write data to the TCP connection. If no ack is needed use the special
NoAck
object. The connection actor will reply with a CommandFailed
message if the write could not be enqueued. If SimpleWriteCommand#wantsAck
returns true, the connection actor will reply with the supplied SimpleWriteCommand#ack
token once the write has been successfully enqueued to the O/S kernel.
Note that this does not in any way guarantee that the data will be
or have been sent! Unfortunately there is no way to determine whether
a particular write has been sent by the O/S.
Common interface for all write commands.
Write count
bytes starting at position
from file at filePath
to the connection.
Write count
bytes starting at position
from file at filePath
to the connection.
The count must be > 0. The connection actor will reply with a CommandFailed
message if the write could not be enqueued. If SimpleWriteCommand#wantsAck
returns true, the connection actor will reply with the supplied SimpleWriteCommand#ack
token once the write has been successfully enqueued to the O/S kernel.
Note that this does not in any way guarantee that the data will be
or have been sent! Unfortunately there is no way to determine whether
a particular write has been sent by the O/S.
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.
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. This means that all writes preceding
the first CommandFailed message have been enqueued to the O/S kernel at this
point.
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.
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. The sender of this command and the registered handler for
incoming data will both be notified once the socket is closed using a
Aborted
message.
The connection has been aborted in response to an Abort
command.
A normal close operation will first flush pending writes and then close the socket.
A normal close operation will first flush pending writes and then close the
socket. The sender of this command and the registered handler for incoming
data will both be notified once the socket is closed using a Closed
message.
The connection has been closed normally in response to a Close
command.
A confirmed close operation will flush pending writes and half-close the connection, waiting for the peer to close the other half.
A confirmed close operation will flush pending writes and half-close the
connection, waiting for the peer to close the other half. The sender of this
command and the registered handler for incoming data will both be notified
once the socket is closed using a ConfirmedClosed
message.
The connection has been half-closed by us and then half-close by the peer
in response to a ConfirmedClose
command.
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
.
The peer has closed its writing half of the connection.
This command needs to be sent to the connection actor after a SuspendReading
command in order to resume reading from the socket.
This command needs to be sent to the connection actor after a SuspendReading
command in order to resume reading from the socket.
(This message is marked with DeadLetterSuppression as it is prone to end up in DeadLetters when the connection is torn down at the same time as the user wants to resume reading on that connection.)
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.
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. All WriteCommand processed by the
connection actor between the first CommandFailed and subsequent reception of
this message will also be rejected with CommandFailed.
Scala API: this object contains all applicable socket options for TCP.
Scala API: this object contains all applicable socket options for TCP.
For the Java API see TcpSO.
Sending this command to the connection actor will disable reading from the TCP socket.
Sending this command to the connection actor will disable reading from the TCP
socket. TCP flow-control will then propagate backpressure to the sender side
as buffers fill up on either end. To re-enable reading send ResumeReading
.
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).
Returns an instance of the extension identified by this ExtensionId instance.
Returns an instance of the extension identified by this ExtensionId instance.
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.
Java API: retrieve the Tcp extension for the given system.
Java API: retrieve the Tcp extension for the given system.
Returns the canonical ExtensionId for this Extension
Returns the canonical ExtensionId for this Extension
TCP Extension for Akka’s IO layer.
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 connections send a Tcp.Bind message to the TcpExt#manager.
The Java API for generating TCP commands is available at TcpMessage.