Class Tcp.IncomingConnection

  • Enclosing class:
    Tcp

    public static class Tcp.IncomingConnection
    extends java.lang.Object
    Represents an accepted incoming TCP connection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Flow<ByteString,​ByteString,​NotUsed> flow()
      A flow representing the client on the other side of the connection.
      <Mat> Mat handleWith​(Flow<ByteString,​ByteString,​Mat> handler, ClassicActorSystemProvider systemProvider)
      Handles the connection using the given flow, which is materialized exactly once and the respective materialized value is returned.
      <Mat> Mat handleWith​(Flow<ByteString,​ByteString,​Mat> handler, Materializer materializer)
      Handles the connection using the given flow, which is materialized exactly once and the respective materialized value is returned.
      java.net.InetSocketAddress localAddress()
      The local address this connection is bound to.
      java.net.InetSocketAddress remoteAddress()
      The remote address this connection is bound to.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • flow

        public Flow<ByteString,​ByteString,​NotUsed> flow()
        A flow representing the client on the other side of the connection. This flow can be materialized only once.
      • handleWith

        public <Mat> Mat handleWith​(Flow<ByteString,​ByteString,​Mat> handler,
                                    ClassicActorSystemProvider systemProvider)
        Handles the connection using the given flow, which is materialized exactly once and the respective materialized value is returned.

        Convenience shortcut for: flow.joinMat(handler, Keep.right).run(systemProvider).

        Note that the classic or typed ActorSystem can be used as the systemProvider parameter.

      • handleWith

        public <Mat> Mat handleWith​(Flow<ByteString,​ByteString,​Mat> handler,
                                    Materializer materializer)
        Handles the connection using the given flow, which is materialized exactly once and the respective materialized value is returned.

        Convenience shortcut for: flow.joinMat(handler, Keep.right).run(materializer).

        Prefer the method taking an ActorSystem unless you have special requirements

      • localAddress

        public java.net.InetSocketAddress localAddress()
        The local address this connection is bound to.
      • remoteAddress

        public java.net.InetSocketAddress remoteAddress()
        The remote address this connection is bound to.