Muokkaa

Jaa


NamedPipeClientStream.ConnectAsync Method

Definition

A task that represents the asynchronous connect operation.

Overloads

ConnectAsync()

Asynchronously connects to a waiting server with an infinite timeout period.

ConnectAsync(Int32)

Asynchronously connects to a waiting server within the specified timeout period.

ConnectAsync(CancellationToken)

Asynchronously connects to a waiting server and monitors cancellation requests.

ConnectAsync(Int32, CancellationToken)

Asynchronously connects to a waiting server within the specified timeout period and monitors cancellation requests.

ConnectAsync(TimeSpan, CancellationToken)

Asynchronously connects to a waiting server within the specified timeout period and monitors cancellation requests.

ConnectAsync()

Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs

Asynchronously connects to a waiting server with an infinite timeout period.

public:
 System::Threading::Tasks::Task ^ ConnectAsync();
public System.Threading.Tasks.Task ConnectAsync ();
member this.ConnectAsync : unit -> System.Threading.Tasks.Task
Public Function ConnectAsync () As Task

Returns

A task that represents the asynchronous connect operation.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Connect().

Applies to

ConnectAsync(Int32)

Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs

Asynchronously connects to a waiting server within the specified timeout period.

public:
 System::Threading::Tasks::Task ^ ConnectAsync(int timeout);
public System.Threading.Tasks.Task ConnectAsync (int timeout);
member this.ConnectAsync : int -> System.Threading.Tasks.Task
Public Function ConnectAsync (timeout As Integer) As Task

Parameters

timeout
Int32

The number of milliseconds to wait for the server to respond before the connection times out.

Returns

A task that represents the asynchronous connect operation.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Connect(Int32).

Applies to

ConnectAsync(CancellationToken)

Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs

Asynchronously connects to a waiting server and monitors cancellation requests.

public:
 System::Threading::Tasks::Task ^ ConnectAsync(System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task ConnectAsync (System.Threading.CancellationToken cancellationToken);
member this.ConnectAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ConnectAsync (cancellationToken As CancellationToken) As Task

Parameters

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous connect operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Connect().

Applies to

ConnectAsync(Int32, CancellationToken)

Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs

Asynchronously connects to a waiting server within the specified timeout period and monitors cancellation requests.

public:
 System::Threading::Tasks::Task ^ ConnectAsync(int timeout, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task ConnectAsync (int timeout, System.Threading.CancellationToken cancellationToken);
member this.ConnectAsync : int * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ConnectAsync (timeout As Integer, cancellationToken As CancellationToken) As Task

Parameters

timeout
Int32

The number of milliseconds to wait for the server to respond before the connection times out.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous connect operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Connect(Int32).

Applies to

ConnectAsync(TimeSpan, CancellationToken)

Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs
Source:
NamedPipeClientStream.cs

Asynchronously connects to a waiting server within the specified timeout period and monitors cancellation requests.

public:
 System::Threading::Tasks::Task ^ ConnectAsync(TimeSpan timeout, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task ConnectAsync (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.ConnectAsync : TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ConnectAsync (timeout As TimeSpan, cancellationToken As CancellationToken) As Task

Parameters

timeout
TimeSpan

The amount of time to wait for the server to respond before the connection times out.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous connect operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Connect(TimeSpan).

Applies to