Tcp Module

Types

Type Description

StartedData

TcpServer

TcpWorker<'a>

A TCP Worker is a thing that takes a TCP client and returns an asynchronous workflow thereof.

Functions and values

Function or value Description

MaxBacklog

Full Usage: MaxBacklog

Returns: int

The max backlog of number of requests

Returns: int

createConnection listenSocket binding cancellationToken bufferSize

Full Usage: createConnection listenSocket binding cancellationToken bufferSize

Parameters:
Returns: Connection
listenSocket : Socket
binding : HttpBinding
cancellationToken : CancellationToken
bufferSize : int
Returns: Connection

createConnectionFacade tracker connectionPool listenSocket binding runtime cancellationToken bufferSize webpart

Full Usage: createConnectionFacade tracker connectionPool listenSocket binding runtime cancellationToken bufferSize webpart

Parameters:
Returns: ConnectionFacade
tracker : ActiveConnectionTracker<ConnectionFacade>
connectionPool : ConcurrentPool<ConnectionFacade>
listenSocket : Socket
binding : HttpBinding
runtime : HttpRuntime
cancellationToken : CancellationToken
bufferSize : int
webpart : WebPart
Returns: ConnectionFacade

createPools listenSocket binding maxOps runtime cancellationToken bufferSize webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds

Full Usage: createPools listenSocket binding maxOps runtime cancellationToken bufferSize webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds

Parameters:
Returns: ConcurrentPool<ConnectionFacade>
listenSocket : Socket
binding : HttpBinding
maxOps : int
runtime : HttpRuntime
cancellationToken : CancellationToken
bufferSize : int
webpart : WebPart
healthCheckEnabled : bool
healthCheckIntervalMs : int
maxConnectionAgeSeconds : int
Returns: ConcurrentPool<ConnectionFacade>

createReader transport pipe cancellationToken

Full Usage: createReader transport pipe cancellationToken

Parameters:
Returns: HttpReader
transport : ITransport
pipe : Pipe
cancellationToken : CancellationToken
Returns: HttpReader

createTransport listenSocket binding cancellationToken

Full Usage: createTransport listenSocket binding cancellationToken

Parameters:
Returns: ITransport
listenSocket : Socket
binding : HttpBinding
cancellationToken : CancellationToken
Returns: ITransport

enableRebinding listenSocket

Full Usage: enableRebinding listenSocket

Parameters:
listenSocket : Socket

runServer maxConcurrentOps bufferSize binding runtime cancellationToken webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds startData acceptingConnections

Full Usage: runServer maxConcurrentOps bufferSize binding runtime cancellationToken webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds startData acceptingConnections

Parameters:
Returns: Task

Backwards-compatible single-acceptor entry point.

maxConcurrentOps : int
bufferSize : int
binding : SocketBinding
runtime : HttpRuntime
cancellationToken : CancellationToken
webpart : WebPart
healthCheckEnabled : bool
healthCheckIntervalMs : int
maxConnectionAgeSeconds : int
startData : StartedData
acceptingConnections : AsyncResultCell<StartedData>
Returns: Task

runServerEx acceptorCount maxConcurrentOps bufferSize binding runtime cancellationToken webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds startData acceptingConnections

Full Usage: runServerEx acceptorCount maxConcurrentOps bufferSize binding runtime cancellationToken webpart healthCheckEnabled healthCheckIntervalMs maxConnectionAgeSeconds startData acceptingConnections

Parameters:
Returns: Task
acceptorCount : int
maxConcurrentOps : int
bufferSize : int
binding : SocketBinding
runtime : HttpRuntime
cancellationToken : CancellationToken
webpart : WebPart
healthCheckEnabled : bool
healthCheckIntervalMs : int
maxConnectionAgeSeconds : int
startData : StartedData
acceptingConnections : AsyncResultCell<StartedData>
Returns: Task

startTcpIpServer binding runServer

Full Usage: startTcpIpServer binding runServer

Parameters:
Returns: Async<StartedData option> * Task
binding : SocketBinding
runServer : TcpServer
Returns: Async<StartedData option> * Task

startTcpIpServerAsync binding runServer

Full Usage: startTcpIpServerAsync binding runServer

Parameters:
Returns: Async<StartedData option> * Task

Start a new TCP server with a specific IP, Port and with a serve_client worker returning an async workflow whose result can be awaited (for when the tcp server has started listening to its address/port combination), and an asynchronous workflow that yields when the full server is cancelled. If the 'has started listening' workflow returns None, then the start timeout expired.

binding : SocketBinding
runServer : TcpServer
Returns: Async<StartedData option> * Task

stopTcp reason socket

Full Usage: stopTcp reason socket

Parameters:
    reason : string
    socket : Socket

Stop the TCP listener server

reason : string
socket : Socket

tryEnableReusePort listenSocket

Full Usage: tryEnableReusePort listenSocket

Parameters:
Returns: bool

Enable SO_REUSEPORT on the listen socket so that multiple sockets can be bound to the same address+port and the kernel will load-balance incoming connections across them. Returns true on platforms that support it (Linux 3.9+, macOS, BSD) and on which setsockopt succeeded; false otherwise (notably Windows, where the semantically-similar SO_REUSEADDR is not a safe substitute and we fall back to a single acceptor).

listenSocket : Socket
Returns: bool