HttpConnectionFactory.ConnectAsync(EndPoint, CancellationToken) 方法

定义

创建与 UriEndPoint的新连接。

public System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Connections.ConnectionContext> ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken = default);
abstract member ConnectAsync : System.Net.EndPoint * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Connections.ConnectionContext>
override this.ConnectAsync : System.Net.EndPoint * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.AspNetCore.Connections.ConnectionContext>
Public Function ConnectAsync (endPoint As EndPoint, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of ConnectionContext)

参数

endPoint
EndPoint

UriEndPoint要连接到的 。

cancellationToken
CancellationToken

要监视取消请求的标记。 默认值是 None

返回

一个 ValueTask<TResult> ,表示异步连接,完成后为新连接生成 ConnectionContext

实现

适用于