Questions tagged [wsastartup]

WSAStartup function is used by process to initiate use of the Winsock DLL

52 questions
16
votes
2 answers

Is it possible to tell if WSAStartup has been called in a process?

I've started writing an ActiveX control that makes use of sockets. Applications that use this control may or may not also use sockets. Is it possible for my control to tell whether WSAStartup has been called? If not, call it. A little test reveals…
hookenz
  • 30,814
  • 37
  • 149
  • 251
15
votes
4 answers

git pull fails with "Either the application has not called WSAStartup, or WSAStartup failed"

I have just installed Windows 10, Visual Studio Community 2015, and Git for Windows. I also installed the latest Bitbucket and GitHub extensions. Within Visual Studio I cloned my Bitbucket.com-hosted repository, and performed these operations…
Nicolas Raoul
  • 55,003
  • 52
  • 197
  • 338
15
votes
1 answer

How does WSAStartup function initiates use of the Winsock DLL?

How does WSAStartup function initiates use of the Winsock DLL? According to the documentation The WSAStartup function must be the first Windows Sockets function called by an application or DLL. It allows an application or DLL to specify the …
Searock
  • 5,488
  • 8
  • 58
  • 95
14
votes
5 answers

C - Undefined Reference to WSAStartup@8'

I am using Code::Blocks, MinGW, and Windows. Im trying to initialize the winsock so that I can work on a project. I keep getting the error Undefined Reference to WSAStartup@8 Anyone know how to go about fixing this? #include #include…
Paulo
  • 141
  • 1
  • 1
  • 4
9
votes
3 answers

What is the cost of WSAStartup and WSACleanup?

I have a c++ win32 program that uses sockets to download some data from a server. Before using sockets on Windows, WSAStartup must be called. MSDN says: "There must be a call to WSACleanup for each successful call to WSAStartup. Only the final…
jeforum
8
votes
1 answer

Bluetooth with C++ and winsock

I'm finding it very hard to get information on Bluetooth communication in C++. Specifically I want to avoid using any third party libraries and I simply want to connect to a device already paired with my computer. The device has already had its…
ritchie888
  • 451
  • 3
  • 11
  • 25
8
votes
1 answer

MinGW + Boost: undefined reference to `WSAStartup@8'

below is what I execute D:\Just4Fun\software\>make -f Makefile.hands stest g++.exe -g -D_WIN32_WINNT=0x0601 -ID:\Boost\boost_1_51_0 -LD:\Boost\boost_1_51_0\stage\lib -LD:\MinGW\lib -lboost_system-mgw46-d-1_51 -lboost_filesystem-mgw46-d-1_51…
OlegG
  • 883
  • 3
  • 9
  • 28
6
votes
3 answers

WSACleanup and atExit

Is it okay to register WSACleanup through atExit function ? We have several applications that can terminate at different points in the code so we would like to avoid putting WSACleanup everywhere throughought the code. Curently we call WSAStartup /…
user119666
6
votes
6 answers

Why does Windows not allow WinSock to be started while impersonating another user

Using my own program or others I can't get winsock to run when calling if the process is created with CreateProcessWithLogonW or CreateProcessAsUserW. It returns this error when I create the socket: WSAEPROVIDERFAILEDINIT 10106 Service provider…
Christopher Tarquini
  • 10,226
  • 15
  • 50
  • 72
5
votes
4 answers

Can calling WSAStartup() from several threads cause a deadlock?

I'm developing an app that has one TCP server and several UDP servers/listeners. Each server is a separate thread, same as the worker threads for established TCP connections. I'm calling WSAStartup() in each of the threads. Sometimes, calling…
5
votes
0 answers

Is it necessary to call WSACleanup before program exit

I have a Windows socket program (XP and above) that calls WSAStartup. Is it necessary to call WSACleanup before the program exits? If I don't, will there be any negative consequences? In particular is: WSACleanup(); exit(0); different from merely…
Neil Mitchell
  • 8,573
  • 1
  • 24
  • 76
4
votes
3 answers

Winsock error code 10014

string SendRequestToServer(std::string url) { struct sockaddr_in addr = { 0 }; struct hostent *host = NULL; // If the URL begins with http://, remove it. if(url.find("http://") == 0) url.erase(0, 7); // Get the host name. string hst =…
Clark Gaebel
  • 15,590
  • 16
  • 61
  • 89
4
votes
3 answers

WSAStartup link error

I am using EVC++ and I want to compile the program which uses the sockets. I've included #include And I have included in project properties a path to Ws2.lib But still get the error at link step: error LNK2019: unresolved external…
erjik
  • 446
  • 9
  • 25
4
votes
2 answers

Is the .NET use of WSAStartup safe for 64-bit apps?

There is a mismatch between the .NET Framework version and the native Win32 version of the WSAData struct, for 64-bit apps, because the order of the fields is different. I had copied the .NET version for use in our C#-based product and a coworker is…
Ron
  • 1,471
  • 16
  • 22
4
votes
1 answer

C# All Sockets Go Down

I'm trying to understand what can cause all sockets for a given applicaiton to go down / close and fail to open again. My application has multiple sockets (http, ftp, etc.) and will run for some time, though at some point (somewhat deterministic),…
Ternary
  • 2,305
  • 3
  • 29
  • 52
1
2 3 4