संपादित करें

इसके माध्यम से साझा किया गया


SocketAsyncEventArgs.ConnectByNameError Property

Definition

Gets the exception in the case of a connection failure when a DnsEndPoint was used.

public:
 property Exception ^ ConnectByNameError { Exception ^ get(); };
public Exception ConnectByNameError { get; }
public Exception? ConnectByNameError { get; }
member this.ConnectByNameError : Exception
Public ReadOnly Property ConnectByNameError As Exception

Property Value

An Exception that indicates the cause of the connection error when a DnsEndPoint was specified for the RemoteEndPoint property.

Remarks

In the case of a connection failure when a DnsEndPoint was specified for the RemoteEndPoint property, the ConnectByNameError property will contain the exception that indicates the detailed cause of the socket error.

When an IPEndPoint was specified for the RemoteEndPoint property and a connection failure occurs, the ConnectByNameError property will be a null reference.

The SocketError property is always set in the case of a connection failure. The ConnectByNameError property contains more information about the failure if it was a failure connecting to a DnsEndPoint. If an application is only interested in whether the connect operation succeeded or failed, then the application only needs to check the SocketError property.

Applies to

See also