.NET Documentation

System.Net.Sockets Namespace

SocketAsyncException

Namespace: System.Net.Sockets

Represents an error that occurs during an asynchronous socket operation.


public sealed class SocketAsyncException : Exception
                

Remarks

The SocketAsyncException class is used to indicate that an error has occurred during an asynchronous socket operation. This exception is typically thrown by methods that use the SocketAsyncEventArgs class for asynchronous operations, such as Socket.AcceptAsync, Socket.ConnectAsync, Socket.ReceiveAsync, and Socket.SendAsync.

When you catch a SocketAsyncException, you can examine its properties to get more information about the error. The ErrorCode property provides a specific error code that can be used for further diagnosis.

Constructors

SocketAsyncException()

Initializes a new instance of the SocketAsyncException class.


public SocketAsyncException();
                    

SocketAsyncException(string message)

Initializes a new instance of the SocketAsyncException class with a specified error message.


public SocketAsyncException(string message);
                    

SocketAsyncException(string message, Exception innerException)

Initializes a new instance of the SocketAsyncException class with a specified error message and a reference to the inner exception that is the cause of this exception.


public SocketAsyncException(string message, Exception innerException);
                    

Properties

ErrorCode

Gets the error code associated with the exception.


public int ErrorCode { get; }
                    

Inheritance

System.Object

System.Exception

System.Net.Sockets.SocketAsyncException

See Also