NamedPipeClientStream.ConnectAsync 方法

定義

表示非同步作業的工作。A task that represents the asynchronous connect operation.

多載

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()

以無限的逾時期限非同步連線到等候中伺服器。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

傳回

Task

表示非同步作業的工作。A task that represents the asynchronous connect operation.

適用於

ConnectAsync(Int32)

在指定的逾時期限內非同步連線到等候中伺服器。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

參數

timeout
Int32

等候伺服器回應的毫秒數,經過這段時間即為連線逾時。The number of milliseconds to wait for the server to respond before the connection times out.

傳回

Task

表示非同步作業的工作。A task that represents the asynchronous connect operation.

適用於

ConnectAsync(CancellationToken)

非同步連線到等候中伺服器,並且監視取消要求。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

參數

cancellationToken
CancellationToken

用來監視是否有取消要求的語彙基元。The token to monitor for cancellation requests. 預設值為 NoneThe default value is None.

傳回

Task

表示非同步作業的工作。A task that represents the asynchronous connect operation.

適用於

ConnectAsync(Int32, CancellationToken)

在指定的逾時期限內非同步連線到等候中伺服器,並且監視取消要求。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

參數

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. 預設值為 NoneThe default value is None.

傳回

Task

表示非同步作業的工作。A task that represents the asynchronous connect operation.

適用於