Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.09.01;
Скачать: CL | DM;

Вниз

Sockets API   Найти похожие ветки 

 
panov ©   (2003-06-27 14:12) [0]

Если сокеты(socket) создаются в различных потоках, необходимо ли в каждом потоке при создании вызавать WSAStartup, а при уничтожении потока WSACleanup, или WSACleanup достаточно выполнить один раз для всего приложения?
Проблема в том, что если в потоке не выдать WSACleanup, то после уничтожения потока с сокетом остается "мертвый" поток, созданный после WSAStartup+connect.

Спасибо.
-------------------


 
Wonder ©   (2003-06-27 14:27) [1]

This function MUST be the first Windows Sockets function called by an application or DLL. It allows an application or DLL to specify the version of Windows Sockets API required and to retrieve details of the specific Windows Sockets implementation. The application or DLL may only issue further Windows Sockets API functions after a successful WSAStartup() invocation.

Вообще-то, наверное, надо только один раз вызвать. Но:

An application or DLL may call WSAStartup() more than once if it needs to obtain the WSAData structure information more than once. However, the wVersionRequired parameter is assumed to be the same on all calls to WSAStartup(); that is, an application or DLL cannot change the version of Windows Sockets it expects after the initial call to WSAStartup().

There must be one WSACleanup() call corresponding to every WSAStartup() call to allow third-party DLLs to make use of a Windows Sockets DLL on behalf of an application. This means, for example, that if an application calls WSAStartup() three times, it must call WSACleanup() three times. The first two calls to WSACleanup() do nothing except decrement an internal counter; the final WSACleanup() call for the task does all necessary resource deallocation for the task.





Страницы: 1 вся ветка

Текущий архив: 2003.09.01;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.014 c
14-1604
Ajax
2003-08-13 00:02
2003.09.01
Сотовая связь в Питере


4-1728
irq
2003-06-27 11:26
2003.09.01
Инструментальная панель


14-1563
VEG
2003-08-11 20:20
2003.09.01
Радиосеть


1-1501
Viktor Kushnir
2003-08-17 15:45
2003.09.01
Получить текст


4-1710
andre
2003-06-21 02:24
2003.09.01
таймер