Represents an error that occurs during a socket operation.
Initializes a new instance of the SocketException class.
int errorCode)
Initializes a new instance of the SocketException class with the specified error code.
intstring message)
Initializes a new instance of the SocketException class with a specified error message.
stringstring message, Exception innerException)
Initializes a new instance of the SocketException class with a specified error message and a reference to the inner exception that is the cause of this exception.
stringinnerException is not null, the current exception is raised in a catch block that handles the inner exception.int
Gets the error code associated with this exception.
string
Gets a message that describes the current exception.
Gets the exception that is the cause of the current exception.
string
Gets a string representation of the immediate frames of the call stack.
Gets the method that throws the current exception.
string
Gets or sets a link to the help file associated with this exception.
string
Gets or sets the name of the application or the object that causes the error.
string
Returns a string representation of the current exception.
void
Sets the SerializationInfo object with information about the exception.
The SocketException class provides specific information about network errors that occur during socket operations. The ErrorCode property contains a specific system error code that can be used to diagnose the problem further. Common error codes include:
10013: An attempt was made to access a socket in a way forbidden by its access permissions.10048: Only one usage of each socket address (protocol/network address/port) is normally permitted.10054: An existing connection was forcibly closed by the remote host.10060: A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.10061: No connection could be made because the target computer actively refused it.You can use the ErrorCode to look up the specific error message provided by the operating system or network stack.