Click or drag to resize
MimeKit

ProxyClientConnect(String, Int32, Int32, CancellationToken) Method

Connect to the target host.

Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public virtual Stream Connect(
	string host,
	int port,
	int timeout,
	CancellationToken cancellationToken = default
)

Parameters

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

Return Value

Stream
The connected network stream.

Implements

IProxyClientConnect(String, Int32, Int32, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionhost is null.
ArgumentOutOfRangeException

port is not between 1 and 65535.

-or-

timeout is less than -1.

ArgumentException The host is a zero-length string.
OperationCanceledException The operation was canceled via the cancellation token.
TimeoutException The operation timed out.
SocketException A socket error occurred trying to connect to the remote host.
IOException An I/O error occurred.
Remarks
Connects to the target host and port through the proxy server.
See Also