Skip to content
Auto
Products

NamedPipeClientPoolLink

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

Holds one connection taken from a NamedPipeClientPool for as long as the link is alive, so several requests run on the same connection.

public class NamedPipeClientPoolLink : System.IDisposable

Inheritance: object → NamedPipeClientPoolLink

Disposing the link returns the connection to the pool. Until then the pool cannot hand that connection to anyone else, so a link that is never disposed shrinks the pool by one.

Gets a value indicating whether the connection is believed to be alive.

public bool IsConnected { get; }

bool

This turns to false once a request fails or the client is disposed. A connection that the other side dropped while idle still reads as true, because a named pipe reveals that only when it is used.

Gets a value indicating whether the connection has been returned to the pool.

public bool IsDisposed { get; }

bool

Gets the name of the pipe the connection points to.

public string PipeName { get; }

string

Opens the connection and agrees an encoding with the server. Returns at once when the client is already connected.

public void Connect()

Opens the connection and agrees an encoding with the server. Returns at once when the client is already connected.

public void Connect(int timeout)
  • timeout int
    How long to wait for the server, in milliseconds. Default: 100.

Opens the connection and agrees an encoding with the server. Returns at once when the client is already connected.

public Task ConnectAsync()

Task

Opens the connection and agrees an encoding with the server. Returns at once when the client is already connected.

public Task ConnectAsync(int timeout, CancellationToken token)
  • timeout int
    How long to wait for the server, in milliseconds. Default: 100.
  • token CancellationToken
    The token that cancels waiting for the server.

Task

Returns the connection to the pool.

public virtual void Dispose()

Sends a request and waits for the response.

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.

Sends a request and waits for the response.

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.