This documentation is archived and is not being maintained.

SocketException Class

The exception that is thrown when a socket error occurs.

For a list of all members of this type, see SocketException Members.


[Visual Basic]
Public Class SocketException
   Inherits Win32Exception
public class SocketException : Win32Exception
public __gc class SocketException : public Win32Exception
class SocketException extends Win32Exception

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


A SocketException is thrown by the Socket and Dns classes when an error occurs with the network.

The default constructor for the SocketException class sets the ErrorCode property to the last operating system socket error that occurred. For more information about socket error codes, see the Windows Socket Version 2 API error code documentation in MSDN.


Namespace: System.Net.Sockets

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System (in System.dll)

See Also

SocketException Members | System.Net.Sockets Namespace | Exception