QuicListener.AcceptConnectionAsync(CancellationToken) Method

Definition

Accepts an inbound QuicConnection.

public System.Threading.Tasks.ValueTask<System.Net.Quic.QuicConnection> AcceptConnectionAsync (System.Threading.CancellationToken cancellationToken = default);
member this.AcceptConnectionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Net.Quic.QuicConnection>
Public Function AcceptConnectionAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of QuicConnection)

Parameters

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

A task that contains a fully connected QuicConnection that successfully finished the handshake and is ready to be used.

Exceptions

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

Remarks

QuicListener doesn't have a mechanism to report inbound connections that fail the handshake process. Such connections are only logged by the listener and never surfaced on the outside.

This method propagates exceptions from ConnectionOptionsCallback, including validation errors from misconfigured QuicServerConnectionOptions, for example, ArgumentException. It also propagates exceptions from failed connection handshakes, for example, AuthenticationException and QuicException.

Applies to