Package akka.io
Class TcpManager
- java.lang.Object
-
- akka.io.SelectionHandler.SelectorBasedManager
-
- akka.io.TcpManager
-
- All Implemented Interfaces:
Actor
,ActorLogging
public class TcpManager extends SelectionHandler.SelectorBasedManager implements ActorLogging
INTERNAL APITcpManager is a facade for accepting commands (
Tcp.Command
) to open client or server TCP connections.TcpManager is obtainable by calling
(seeIO(Tcp)
IO
andTcp
) == Bind == To bind and listen to a local address, a {@link akka.io.Tcp.Bind} command must be sent to this actor. If the binding was successful, the sender of the {@link akka.io.Tcp.Bind} will be notified with a {@link akka.io.Tcp.Bound} message. The sender() of the {@link akka.io.Tcp.Bound} message is the Listener actor (an internal actor responsible for listening to server events). To unbind the port an {@link akka.io.Tcp.Unbind} message must be sent to the Listener actor. If the bind request is rejected because the Tcp system is not able to register more channels (see the nr-of-selectors and max-channels configuration options in the akka.io.tcp section of the configuration) the sender will be notified with a {@link akka.io.Tcp.CommandFailed} message. This message contains the original command for reference. When an inbound TCP connection is established, the handler will be notified by a {@link akka.io.Tcp.Connected} message. The sender of this message is the Connection actor (an internal actor representing the TCP connection). At this point the procedure is the same as for outbound connections (see section below). == Connect == To initiate a connection to a remote server, a {@link akka.io.Tcp.Connect} message must be sent to this actor. If the connection succeeds, the sender() will be notified with a {@link akka.io.Tcp.Connected} message. The sender of the {@link akka.io.Tcp.Connected} message is the Connection actor (an internal actor representing the TCP connection). Before starting to use the connection, a handler must be registered to the Connection actor by sending a {@link akka.io.Tcp.Register} command message. After a handler has been registered, all incoming data will be sent to the handler in the form of {@link akka.io.Tcp.Received} messages. To write data to the connection, a {@link akka.io.Tcp.Write} message must be sent to the Connection actor. If the connect request is rejected because the Tcp system is not able to register more channels (see the nr-of-selectors and max-channels configuration options in the akka.io.tcp section of the configuration) the sender will be notified with a {@link akka.io.Tcp.CommandFailed} message. This message contains the original command for reference.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description TcpManager(TcpExt tcp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.-
Methods inherited from class akka.io.SelectionHandler.SelectorBasedManager
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, selectorPool, self, supervisorStrategy, workerForCommandHandler
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, preStart, sender, unhandled
-
Methods inherited from interface akka.actor.ActorLogging
_log_$eq, log
-
-
-
-
Constructor Detail
-
TcpManager
public TcpManager(TcpExt tcp)
-
-
Method Detail
-
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface:Actor
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
-
-