Class TcpExt
TBD
Implements
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public class TcpExt : IExtension
Fields
| Improve this Doc View SourceBindShutdownTimeout
TBD
Declaration
protected readonly TimeSpan BindShutdownTimeout
Field Value
Type | Description |
---|---|
TimeSpan |
Methods
| Improve this Doc View SourceBind(String, Int32, Int32, IImmutableList<Inet.SocketOption>, Boolean, Nullable<TimeSpan>)
Creates a Tcp.ServerBinding instance which represents a prospective TCP server binding on the given host
and port
/>.
Please note that the startup of the server is asynchronous, i.e. after materializing the enclosing RunnableGraph<TMat> the server is not immediately available. Only after the materialized future completes is the server ready to accept client connections.
Declaration
public Source<Tcp.IncomingConnection, Task<Tcp.ServerBinding>> Bind(string host, int port, int backlog = 100, IImmutableList<Inet.SocketOption> options = null, bool halfClose = false, TimeSpan? idleTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | host | The host to listen on |
Int32 | port | The port to listen on |
Int32 | backlog | Controls the size of the connection backlog |
System.Collections.Immutable.IImmutableList<Inet.SocketOption> | options | TCP options for the connections, see Tcp for details |
Boolean | halfClose | Controls whether the connection is kept open even after writing has been completed to the accepted TCP connections. If set to true, the connection will implement the TCP half-close mechanism, allowing the client to write to the connection even after the server has finished writing. The TCP socket is only closed after both the client and server finished writing. If set to false, the connection will immediately closed once the server closes its write side, independently whether the client is still attempting to write. This setting is recommended for servers, and therefore it is the default setting. |
Nullable<TimeSpan> | idleTimeout | TBD |
Returns
Type | Description |
---|---|
Source<Tcp.IncomingConnection, Task<Tcp.ServerBinding>> | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | TBD |
BindAndHandle(Flow<ByteString, ByteString, NotUsed>, IMaterializer, String, Int32, Int32, IImmutableList<Inet.SocketOption>, Boolean, Nullable<TimeSpan>)
Creates a Tcp.ServerBinding instance which represents a prospective TCP server binding on the given host
and port
/>
handling the incoming connections using the provided Flow.
Please note that the startup of the server is asynchronous, i.e. after materializing the enclosing RunnableGraph<TMat> the server is not immediately available. Only after the materialized future completes is the server ready to accept client connections.
Declaration
public Task<Tcp.ServerBinding> BindAndHandle(Flow<ByteString, ByteString, NotUsed> handler, IMaterializer materializer, string host, int port, int backlog = 100, IImmutableList<Inet.SocketOption> options = null, bool halfClose = false, TimeSpan? idleTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
Flow<ByteString, ByteString, NotUsed> | handler | A Flow that represents the server logic |
IMaterializer | materializer | TBD |
String | host | The host to listen on |
Int32 | port | The port to listen on |
Int32 | backlog | Controls the size of the connection backlog |
System.Collections.Immutable.IImmutableList<Inet.SocketOption> | options | TCP options for the connections, see Tcp for details |
Boolean | halfClose | Controls whether the connection is kept open even after writing has been completed to the accepted TCP connections. If set to true, the connection will implement the TCP half-close mechanism, allowing the client to write to the connection even after the server has finished writing. The TCP socket is only closed after both the client and server finished writing. If set to false, the connection will immediately closed once the server closes its write side, independently whether the client is still attempting to write. This setting is recommended for servers, and therefore it is the default setting. |
Nullable<TimeSpan> | idleTimeout | TBD |
Returns
Type | Description |
---|---|
Task<Tcp.ServerBinding> | TBD |
OutgoingConnection(EndPoint, EndPoint, IImmutableList<Inet.SocketOption>, Boolean, Nullable<TimeSpan>, Nullable<TimeSpan>)
Creates a Tcp.OutgoingConnection instance representing a prospective TCP client connection to the given endpoint.
Note that the ByteString chunk boundaries are not retained across the network, to achieve application level chunks you have to introduce explicit framing in your streams, for example using the Framing stages.
Declaration
public Flow<ByteString, ByteString, Task<Tcp.OutgoingConnection>> OutgoingConnection(EndPoint remoteAddress, EndPoint localAddress = null, IImmutableList<Inet.SocketOption> options = null, bool halfClose = true, TimeSpan? connectionTimeout = null, TimeSpan? idleTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | remoteAddress | The remote address to connect to |
EndPoint | localAddress | Optional local address for the connection |
System.Collections.Immutable.IImmutableList<Inet.SocketOption> | options | TCP options for the connections, see Tcp for details |
Boolean | halfClose | Controls whether the connection is kept open even after writing has been completed to the accepted TCP connections. If set to true, the connection will implement the TCP half-close mechanism, allowing the server to write to the connection even after the client has finished writing.The TCP socket is only closed after both the client and server finished writing. This setting is recommended for clients and therefore it is the default setting. If set to false, the connection will immediately closed once the client closes its write side, independently whether the server is still attempting to write. |
Nullable<TimeSpan> | connectionTimeout | TBD |
Nullable<TimeSpan> | idleTimeout | TBD |
Returns
Type | Description |
---|---|
Flow<ByteString, ByteString, Task<Tcp.OutgoingConnection>> | TBD |
OutgoingConnection(String, Int32)
Creates an Tcp.OutgoingConnection without specifying options. It represents a prospective TCP client connection to the given endpoint.
Note that the ByteString chunk boundaries are not retained across the network, to achieve application level chunks you have to introduce explicit framing in your streams, for example using the Framing stages.
Declaration
public Flow<ByteString, ByteString, Task<Tcp.OutgoingConnection>> OutgoingConnection(string host, int port)
Parameters
Type | Name | Description |
---|---|---|
String | host | TBD |
Int32 | port | TBD |
Returns
Type | Description |
---|---|
Flow<ByteString, ByteString, Task<Tcp.OutgoingConnection>> | TBD |