Click or drag to resize
MimeKit

HttpsProxyClientConnectAsync(String, Int32, CancellationToken) Method

Asynchronously connect to the target host.

Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public override Task<Stream> ConnectAsync(
	string host,
	int port,
	CancellationToken cancellationToken = default
)

Parameters

host  String
The host name of the proxy server.
port  Int32
The proxy server port.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

TaskStream
The connected network stream.

Implements

IProxyClientConnectAsync(String, Int32, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionhost is null.
ArgumentOutOfRangeExceptionport is not between 0 and 65535.
ArgumentException The host is a zero-length string.
OperationCanceledException The operation was canceled via the cancellation token.
SocketException A socket error occurred trying to connect to the remote host.
IOException An I/O error occurred.
Remarks
Asynchronously connects to the target host and port through the proxy server.
See Also