Socks 5ClientConnect(String, Int 32, Cancellation Token) Method
Connect to the target host.
Definition
Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
The connected network stream.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public override Stream Connect(
string host,
int port,
CancellationToken cancellationToken = default
)Parameters
- host String
- The host name of the target server.
- port Int32
- The target server port.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
StreamThe connected network stream.
Implements
IProxyClientConnect(String, Int32, CancellationToken)Remarks
Connects to the target host and port through the proxy server.
Exceptions
| ArgumentNullException | host is . |
| ArgumentOutOfRangeException | port 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. |