|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.io.TcpMessage$
public class TcpMessage$
Field Summary | |
---|---|
static TcpMessage$ |
MODULE$
Static reference to the singleton instance of this Scala object. |
Constructor Summary | |
---|---|
TcpMessage$()
|
Method Summary | |
---|---|
Tcp.Command |
abort()
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. |
Tcp.Command |
bind(ActorRef handler,
java.net.InetSocketAddress endpoint,
int backlog)
Open a listening socket without specifying options. |
Tcp.Command |
bind(ActorRef handler,
java.net.InetSocketAddress endpoint,
int backlog,
java.lang.Iterable<Inet.SocketOption> options)
The Bind message is send to the TCP manager actor, which is obtained via TcpExt.getManager() in order to bind to a listening socket. |
Tcp.Command |
close()
A normal close operation will first flush pending writes and then close the socket. |
Tcp.Command |
confirmedClose()
A confirmed close operation will flush pending writes and half-close the connection, waiting for the peer to close the other half. |
Tcp.Command |
connect(java.net.InetSocketAddress remoteAddress)
Connect to the given remoteAddress without binding to a local address and without
specifying options. |
Tcp.Command |
connect(java.net.InetSocketAddress remoteAddress,
scala.concurrent.duration.FiniteDuration timeout)
Connect to the given remoteAddress with a connection timeout without binding to a local address and without
specifying options. |
Tcp.Command |
connect(java.net.InetSocketAddress remoteAddress,
java.net.InetSocketAddress localAddress,
java.lang.Iterable<Inet.SocketOption> options)
Connect to the given remoteAddress with an optional localAddress to bind to given the specified Socket Options |
Tcp.Command |
connect(java.net.InetSocketAddress remoteAddress,
java.net.InetSocketAddress localAddress,
java.lang.Iterable<Inet.SocketOption> options,
scala.concurrent.duration.FiniteDuration timeout)
The Connect message is sent to the TCP manager actor, which is obtained via TcpExt.getManager() . |
Tcp.Command |
connect(java.net.InetSocketAddress remoteAddress,
java.lang.Iterable<Inet.SocketOption> options)
Connect to the given remoteAddress without binding to a local address. |
Tcp.NoAck |
noAck()
Default Tcp.NoAck instance which is used when no acknowledgment information is
explicitly provided. |
Tcp.NoAck |
noAck(java.lang.Object token)
Each Tcp.WriteCommand can optionally request a positive acknowledgment to be sent
to the commanding actor. |
Tcp.Command |
register(ActorRef handler)
The same as register(handler, false, false) . |
Tcp.Command |
register(ActorRef handler,
boolean keepOpenOnPeerClosed,
boolean useResumeWriting)
This message must be sent to a TCP connection actor after receiving the Tcp.Connected message. |
Tcp.Command |
resumeReading()
This command needs to be sent to the connection actor after a Tcp.SuspendReading
command in order to resume reading from the socket. |
Tcp.Command |
resumeWriting()
When useResumeWriting is in effect as was indicated in the Tcp.Register message
then this command needs to be sent to the connection actor in order to re-enable
writing after a Tcp.CommandFailed event. |
Tcp.Command |
suspendReading()
Sending this command to the connection actor will disable reading from the TCP socket. |
Tcp.Command |
unbind()
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 Tcp.Bound message). |
Tcp.Command |
write(ByteString data)
The same as write(data, noAck()) . |
Tcp.Command |
write(ByteString data,
Tcp.Event ack)
Write data to the TCP connection. |
Tcp.Command |
writeFile(java.lang.String filePath,
long position,
long count,
Tcp.Event ack)
Write count bytes starting at position from file at filePath to the connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final TcpMessage$ MODULE$
Constructor Detail |
---|
public TcpMessage$()
Method Detail |
---|
public Tcp.Command connect(java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, java.lang.Iterable<Inet.SocketOption> options, scala.concurrent.duration.FiniteDuration timeout)
TcpExt.getManager()
. Either the manager replies with a Tcp.CommandFailed
or the actor handling the new connection replies with a Tcp.Connected
message.
remoteAddress
- is the address to connect tolocalAddress
- optionally specifies a specific address to bind tooptions
- Please refer to TcpSO
for a list of all supported options.timeout
- is the desired connection timeout, null
means "no timeout"public Tcp.Command connect(java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, java.lang.Iterable<Inet.SocketOption> options)
remoteAddress
with an optional localAddress
to bind to given the specified Socket Options
public Tcp.Command connect(java.net.InetSocketAddress remoteAddress, java.lang.Iterable<Inet.SocketOption> options)
remoteAddress
without binding to a local address.
public Tcp.Command connect(java.net.InetSocketAddress remoteAddress)
remoteAddress
without binding to a local address and without
specifying options.
public Tcp.Command connect(java.net.InetSocketAddress remoteAddress, scala.concurrent.duration.FiniteDuration timeout)
remoteAddress
with a connection timeout
without binding to a local address and without
specifying options.
public Tcp.Command bind(ActorRef handler, java.net.InetSocketAddress endpoint, int backlog, java.lang.Iterable<Inet.SocketOption> options)
TcpExt.getManager()
in order to bind to a listening socket. The manager
replies either with a Tcp.CommandFailed
or the actor handling the listen
socket replies with a Tcp.Bound
message. If the local port is set to 0 in
the Bind message, then the Tcp.Bound
message should be inspected to find
the actual port which was bound to.
handler
- The actor which will receive all incoming connection requests
in the form of Tcp.Connected
messages.
localAddress
- The socket address to bind to; use port zero for
automatic assignment (i.e. an ephemeral port, see Bound
)
backlog
- This specifies the number of unaccepted connections the O/S
kernel will hold for this port before refusing connections.
options
- Please refer to TcpSO
for a list of all supported options.public Tcp.Command bind(ActorRef handler, java.net.InetSocketAddress endpoint, int backlog)
public Tcp.Command register(ActorRef handler, boolean keepOpenOnPeerClosed, boolean useResumeWriting)
Tcp.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.
handler
- The actor which will receive all incoming data and which
will be informed when the connection is closed.
keepOpenOnPeerClosed
- If this is set to true then the connection
is not automatically closed when the peer closes its half,
requiring an explicit Tcp.Closed
from our side when finished.
useResumeWriting
- If this is set to true then the connection actor
will refuse all further writes after issuing a Tcp.CommandFailed
notification until Tcp.ResumeWriting
is received. This can
be used to implement NACK-based write backpressure.public Tcp.Command register(ActorRef handler)
register(handler, false, false)
.
public Tcp.Command unbind()
Tcp.Bound
message). The
listener socket actor will reply with a Tcp.Unbound
message.
public Tcp.Command close()
Tcp.Closed
message.
public Tcp.Command confirmedClose()
Tcp.ConfirmedClosed
message.
public Tcp.Command abort()
Tcp.Aborted
message.
public Tcp.NoAck noAck(java.lang.Object token)
Tcp.WriteCommand
can optionally request a positive acknowledgment to be sent
to the commanding actor. If such notification is not desired the Tcp.WriteCommand.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 Tcp.CommandFailed
message.
public Tcp.NoAck noAck()
Tcp.NoAck
instance which is used when no acknowledgment information is
explicitly provided. Its “token” is null
.
public Tcp.Command write(ByteString data, Tcp.Event ack)
NoAck
object. The connection actor will reply with a Tcp.CommandFailed
message if the write could not be enqueued. If Tcp.WriteCommand.wantsAck()
returns true, the connection actor will reply with the supplied Tcp.WriteCommand.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.
public Tcp.Command write(ByteString data)
write(data, noAck())
.
public Tcp.Command writeFile(java.lang.String filePath, long position, long count, Tcp.Event ack)
count
bytes starting at position
from file at filePath
to the connection.
The count must be > 0. The connection actor will reply with a Tcp.CommandFailed
message if the write could not be enqueued. If Tcp.WriteCommand.wantsAck()
returns true, the connection actor will reply with the supplied Tcp.WriteCommand.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.
public Tcp.Command resumeWriting()
useResumeWriting
is in effect as was indicated in the Tcp.Register
message
then this command needs to be sent to the connection actor in order to re-enable
writing after a Tcp.CommandFailed
event. All Tcp.WriteCommand
processed by the
connection actor between the first Tcp.CommandFailed
and subsequent reception of
this message will also be rejected with Tcp.CommandFailed
.
public Tcp.Command suspendReading()
Tcp.ResumeReading
.
public Tcp.Command resumeReading()
Tcp.SuspendReading
command in order to resume reading from the socket.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |