All replies 10093 means WSANOTINITIALIZED, ie, you haven’t initialised Windows Sockets in your application. In the VC menu use “Tools | Error Lookup”; using that to lookup 10093 you will get: Either the application has not called WSAStartup, or WSAStartup failed. Or you can open the winerror.
Socket error 10093 (WSANOTINITIALIZED) means either: WSAStartup () has not been called, or it failed WSACleanup () has been called too many times. In this case, your code is calling WSACleanup () in places it does not belong:
Extended version of Winsock.dll. The current implementation of Windows Sockets definitely does not support the version of the Windows Sockets specification requested by the device. Make sure you don’t use old Windows Sockets DLLs. A successful WSA boot has not yet taken place. Either the application did not call WSAStartup, or WSAStartup may have failed.
When I call the WSAGetLastError() function, it returns 10093. The definition of this error in msdn is: WSA has not yet successfully started.
An application must call the WSACleanup function for each successful call to WSAStartup. This means, for example, that if an application calls WSAStartup once, it must call WSACleanup within 3 months.
How is the wsastartup function used in Winsock?
The WSAStartup function is used to start or initialize the Winsock library. It takes 2 parameters; The first base is the version we want to load, and the second may contain a WSADATA structure that leads to additional information after Winsock is loaded.
Can a successful wsastartup call occur before using the select function?
A successful call to WSAStartup must be available before using this function. The Windows Sockets implementation failed to allocate necessary resources for internal work, or the readfds, writefds, excludefds, and/or timeval options are not part of the user’s address space. The technology has failed in the subsystem.
Why do I get undefined reference to wsastartup?
As we can see, the last symbols are in libraries and collections, where they are referenced by the corresponding -L command line methods. So why “undefined reference”???? This is a very common mistake with a very practical solution: then put a link to the libraries after the source and target files.
How does wsastartup function initiates use of the Winsock DLL?
The WSAStartup operation must be the first Windows Sockets function called by the application, possibly a DLL. This allows an application or other DLL to specify the required version of Windows Sockets and get accurate information about Windows Socket startup.
Can WSAStartup be called multiple times?
By comparison, an application can call WSAStartup multiple times, if necessary, to obtain information about the WSADATA structure multiple times. With each of these calls, the application can specify any specific version number supported by the Winsock DLL.
What does WSAStartup do?
The WSAStartup function should be your first current Windows Sockets function, just called from an application or DLL. This allows the application or DLL to set the requested version of Windows sockets and to obtain information about the chosen sockets of the Windows implementation.
Is it possible to call wsastartup more than once?
An application can call WSAStartup more than once if it needs to find information about the WSADATA structure more than once. With each of these calls, an application can often specify any version group supported by the Winsock DLL. The WSAStartup function is typically used to load protocol dependent helper DLLs.
When to call wsastartup function ( winsock2.h )?
When the Winsock DLL services are finished, the iPhone application must call WSACleanup to allow the Winsock DLL to release the Winsock device resources normally used by the application. An application can call WSAStartup multiple times if it needs to get information about the WSADATA structure multiple times.
What is WSAStartup?
The WSAStartup function must be the first Windows Sockets function called by an application or DLL. This allows the application DLL or you to specify the required version of Windows Sockets and obtain information about the particular implementation of Windows Sockets.

Ermias is a tech writer with a passion for helping people solve Windows problems. He loves to write and share his knowledge with others in the hope that they can benefit from it. He’s been writing about technology and software since he was in college, and has been an avid Microsoft fan ever since he first used Windows 95.