SocketException.ErrorCode Property

Gets the error code that is associated with the current exception.

Namespace: System.Net.Sockets
Assembly: System (in system.dll)

Syntax

public int ErrorCode { get; }

Property Value

A numeric value indicating the error that is associated with the current exception.

Remarks

The default constructor for the SocketException class sets the ErrorCode property to the last network error that occurred. For more information about socket error codes, see the Windows® Sockets 2.0 API error code documentation in the MSDN® Library.

The ErrorCode property can contains the following error codes.

Error Code Value Description
RTSSL_CTX_NOT_VALID -1 The SSL context is not valid.
RTSSL_HANDSHAKE_FAILURE -2 A handshake failure occurred.
RTSSL_NO_PEER_CERTIFICATE 100 The peer's certificate is not recognized or not found.
RTSSL_NO_VALID_PEER_NAME 101 A valid peer name could not be found.
RTSSL_WANT_READ -3 The read operation did not complete. Your program must attempt to read again to obtain the complete data packet.
RTSSL_WANT_WRITE -4 The write operation did not complete. Your program must attempt to write again to transmit the complete data packet.
RTSSL_WRONG_HOST_NAME -5 The supplied host name is not correct.
RTSSL_X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 The AKID and the issuer serial number do not match.
RTSSL_X509_V_ERR_AKID_SKID_MISMATCH 30 The AKID and the SKID do not match.
RTSSL_X509_V_ERR_APPLICATION_VERIFICATION 50 An error occurred in the application verification callback.
RTSSL_X509_V_ERR_CERT_CHAIN_TOO_LONG 22 The certificate chain is too long.
RTSSL_X509_V_ERR_CERT_HAS_EXPIRED 10 The certificate has expired.
RTSSL_X509_V_ERR_CERT_NOT_YET_VALID 9 The certificate is not yet valid.
RTSSL_X509_V_ERR_CERT_REJECTED 28 The certificate was rejected.
RTSSL_X509_V_ERR_CERT_REVOKED 23 The certificate has been revoked.
RTSSL_X509_V_ERR_CERT_SIGNATURE_FAILURE 7 The server certificate has missing or incorrect information.
RTSSL_X509_V_ERR_CERT_UNTRUSTED 27 The certificate was issued by an unstrusted source.
RTSSL_X509_V_ERR_CRL_HAS_EXPIRED 12 The certificate revocation list has expired.
RTSSL_X509_V_ERR_CRL_NOT_YET_VALID 11 The certificate revocation list is not yet valid.
RTSSL_X509_V_ERR_CRL_SIGNATURE_FAILURE 8 The certificate revocation list signature has missing or incorrect information.
RTSSL_X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 A self-signed certificate was encountered at a depth of zero. No trusted signer was found.
RTSSL_X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 The date or time in the NotAfter field is incorrect. It should be expressed in Universal Time, Corrected (UTC).
RTSSL_X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 The date or time in the NotBefore field is incorrect. It should be expressed in Universal Time, Corrected (UTC).
RTSSL_X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 The LastUpdate field contains incorrect information.
RTSSL_X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 The NextUpdate field contains incorrect information.
RTSSL_X509_V_ERR_INVALID_CA 24 The certificate authority is invalid.
RTSSL_X509_V_ERR_INVALID_PURPOSE 26 The Purpose value in your SSL session is invalid.
RTSSL_X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 The key usage does not support certificate signing.
RTSSL_X509_V_ERR_OUT_OF_MEM 17 Not enough memory is available to complete the operation.
RTSSL_X509_V_ERR_PATH_LENGTH_EXCEEDED 25 The path name is too long.
RTSSL_X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 A self-signed certificate was found in the chain of signers.
RTSSL_X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 The subject name did not match the issuer name.
RTSSL_X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 The public key of the issuing server could not be decoded.
RTSSL_X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 The certificate signature could not be decrypted.
RTSSL_X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 The certificate revocation list signature could not be decrypted.
RTSSL_X509_V_ERR_UNABLE_TO_GET_CRL 3 The certificate revocation list could not be retrieved.
RTSSL_X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 The certificate of the issuing server could not be retrieved.
RTSSL_X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 The local issuer certificate could not be retrieved.
RTSSL_X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 The leaf signature could not be verified.
RTSSL_X509_V_OK 0 No error occurred.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

SocketException Class
SocketException Members
System.Net.Sockets Namespace