🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages Started by Eduardo Jauch Fri, 23 Feb 2007 23:12
WSAStartup with threads
#1252
Author: Eduardo Jauch
Date: Fri, 23 Feb 2007 23:12
12 lines
1213 bytes
I have a doubt...

If i have a program with the habilit to create various threads to 
connect to a site via socket (same or different sites), I need to use 
WSAStartup in every one of them or on the main program?

The help says that is possible to call them many times, since the 
WSAClenup be called same number of times...

But my question is: It's necessary? Or on time (on the mais thread), is ok?

Thanks :)
Re: WSAStartup with threads
#1253
Author: Remy Lebeau (TeamB)
Date: Sat, 24 Feb 2007 00:42
15 lines
1410 bytes
"Eduardo Jauch" <eduardo.jauch@gmail.com> wrote in message
news:45df74be@newsgroups.borland.com...

> If i have a program with the habilit to create various threads to
> connect to a site via socket (same or different sites), I need to
> use WSAStartup in every one of them or on the main program?

It doesn't really matter, as WinSock is reference counted.  Calling
WSAStartup() and WSACleanup() in each thread will not hurt anything.
Only the first call to WSAStartup() and the last call to WSACleanup()
are important.  The rest are just adjusting the reference count.


Gambit
Re: WSAStartup with threads
#1254
Author: Eduardo Jauch
Date: Sat, 24 Feb 2007 03:45
10 lines
1364 bytes
Remy Lebeau (TeamB) escreveu:
> It doesn't really matter, as WinSock is reference counted.  Calling
> WSAStartup() and WSACleanup() in each thread will not hurt anything.
> Only the first call to WSAStartup() and the last call to WSACleanup()
> are important.  The rest are just adjusting the reference count.
> 
> 
> Gambit

Thanks :)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads