Attempting to initialize a SocketTools .NET class, ActiveX control or library fails with an error indicating that the networking subsystem cannot be initialized. The application cannot establish a connection, and subsequent attempts to reinitialize the component also fails with the same error message.
More Information
This error can indicate that either the component has not been initialized, or the component is unable to initialize the TCP/IP stack, which is required to establish network connections on the local host.
If this error occurs when using a .NET class or ActiveX control, the application should explicitly call the Initialize method prior to setting any other properties or invoking any other methods. This will ensure that the component is being initialized properly at startup. This is normally done automatically for ActiveX controls, however some development environments may require explicit initialization. For more information, refer to the Initialize method in the documentation.
If you are using the SocketTools API, then you need to call the initialization function specific to that library. For example, if you are using the FTP library then you need to call the FtpInitialize function. Note that if you are developing in C++ and using the class interface, then this initialization is performed for you automatically.
If you are initializing the component or library, and this error is being returned, it can indicate a problem with the networking configuration on the local host. This could be the result of a third-party anti-virus product or software firewall which is preventing the component from dynamically loading and initializing the Windows Sockets subsystem. Specifically, this error can indicate that the WSAStartup function is failing, and returning the error WSAESYSNOTREADY. It is recommended that you check the following:
Windows Sockets
Make sure the appropriate Windows Sockets DLL file is in the current path. If this error occurs only on an end-user system and not your development system, it could indicate that your installation program is including the Windows Sockets library (wsock32.dll) in the installation package and either installing it in a system folder on the target system, or in the application folder. This is a platform specific DLL and should never be redistributed with your application software.
Make sure that you are not trying to use more than one Windows Sockets implementation simultaneously. If there is more than one Windows Sockets DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded. Typically there will not be multiple network subsystem configurations on the same local system, and the presence of multiple Windows Sockets DLLs can indicate a configuration or installation problem.
Check the system configuration to be sure all necessary components are currently installed and configured correctly. If this error is only occurring on an end-user system, they may not have all of the TCP/IP networking components installed and configured correctly.
Layered Service Providers
It is possible that some third-party software installations (or the removal of such software) can corrupt the Windows Sockets subsystem with the installation of a Layered Service Provider (LSP), software that is designed to insert itself into the local system's TCP/IP stack to monitor, intercept and modify data being exchanged over the local network and/or the Internet.
There are two commands that can be used to attempt to restore the TCP/IP subsystem back to a known, functioning state. From the command line (running with Administrator privileges), enter the following command:
netsh int ip reset
This tells the system to reset the networking subsystem to its default values for all interfaces. This is a general purpose "repair" command that remove all user-configured settings for the TCP/IP stack and return them to their original state. It works by rewriting the registry keys used by system to store configuration information for the network, and can also correct problems where those registry keys were deleted or removed. After this command has been entered, reboot the system and check to see if the problem has been resolved.
If the problem persists, another option is to reset the Windows Sockets interface to its default by entering the following command:
netsh winsock reset
This command will reset the Windows Sockets catalog to its default state, effectively removing all third-party Layered Service Providers (LSPs). This command should be used with caution, as may disable the functionality of any software which installed an LSP, and that software would need to be reinstalled. After entering this command, you should reboot the system.
See Also
Unable to Establish Security Context
Unable to Resolve IPv6 Address
Creating a Runtime License Key