I am porting the Linux app under Win32 (msvc 9.0) and after finishing it, I'm experiencing the default behavior as simple as It prints You need to start winsock before starting WSAS socket calls will be successful. Just request the 2.2 version and be done with it. socket () .
#include & lt; Winsock2.h & gt; # Include & lt; Ws2tcpip.h & gt; Int main (int argc, char ** argv) {int subsock; If ((subsock = socket (PF_INET, SOCK_STREAM, 0)) & lt; 0) {printf ("failed to open socket (rate value =% d) \ n", subsock); }}
failed to open socket (rate value = -1) What is wrong every time and how to open socket on win32?
WORD wVersionRequested; WSADATA wsaData; Intel mistake; / * Use the MacDayDard (Kambyte, Hibiite) macro declared in the WifiHeAs. * / WVersionRequested = MAKEWORD (2, 2); Err = wsasartartup (wVersionRequested, and wsaData) if (error! = 0) {yourError! For more information:
Comments
Post a Comment