Pop |
public override Task ConnectAsync( Socket socket, string host, int port = 0, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default )
Exception | Condition |
---|---|
ArgumentNullException | socket is null. -or- host is null. |
ArgumentOutOfRangeException | port is not between 0 and 65535. |
ArgumentException | socket is not connected. -or- The host is a zero-length string. |
ObjectDisposedException | The Pop3Client has been disposed. |
InvalidOperationException | The Pop3Client is already connected. |
NotSupportedException | options was set to StartTls and the POP3 server does not support the STLS extension. |
OperationCanceledException | The operation was canceled via the cancellation token. |
SslHandshakeException | An error occurred during the SSL/TLS negotiations. |
IOException | An I/O error occurred. |
Pop3CommandException | A POP3 command failed. |
Pop3ProtocolException | A POP3 protocol error occurred. |
Establishes a connection to the specified POP3 or POP3/S server using the provided socket.
If the options has a value of Auto, then the port is used to determine the default security options. If the port has a value of 995, then the default options used will be SslOnConnect. All other values will use StartTlsWhenAvailable.
Once a connection is established, properties such as AuthenticationMechanisms and Capabilities will be populated.
Note |
---|
With the exception of using the port to determine the default SecureSocketOptions to use when the options value is Auto, the host and port parameters are only used for logging purposes. |