Skip to content
Auto
Products

NamedPipeClientPool

Namespace: TagBites.Pipes
Assembly: TagBites.Pipes.dll
Product: TagBites.Pipes v. 1.2.0

Keeps a bounded set of reusable connections to a NamedPipeServer and hands them out to callers, so several threads can send requests at once.

public class NamedPipeClientPool : System.IDisposable

Inheritance: object → NamedPipeClientPool

The pool does not guarantee a live connection. A connection that the server dropped while it sat idle fails the next request with NamedPipeConnectionLostException; the pool then discards it, so the request after that gets a fresh one. Callers have to handle that exception. A caller blocks while every connection is busy.

Initializes a new instance of the NamedPipeClientPool class.

public NamedPipeClientPool(string pipeName, int maxConnections)
  • pipeName string
    The name of the pipe to connect to.
  • maxConnections int
    The largest number of connections held at once.

Gets a value indicating whether the pool has been disposed.

public bool IsDisposed { get; }

bool

Gets the name of the pipe the connections point to.

public string PipeName { get; }

string

Waits for every request in flight to finish, then closes all connections.

public virtual void Dispose()

Takes a connection for several requests in a row. Disposing the returned link gives the connection back to the pool.

public NamedPipeClientPoolLink GetConnection()

NamedPipeClientPoolLink

A link holding one connection from the pool.

Takes a connection for several requests in a row. Disposing the returned link gives the connection back to the pool.

public Task<NamedPipeClientPoolLink> GetConnectionAsync()

Task<NamedPipeClientPoolLink>

A link holding one connection from the pool.

Takes a connection, sends a request on it and returns it to the pool.

public string SendRequest(string address, string message)
  • address string
    The address naming the operation. It must not start with --.
  • message string
    The message to send.

string

The response text, which is empty when the handler set no response.

Takes a connection, sends a request on it and returns it to the pool.

public Task<string> SendRequestAsync(string address, string message)
  • address string
    The address naming the operation. It must not start with --.
  • message string
    The message to send.

Task<string>

The response text, which is empty when the handler set no response.