Главная страница
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.015 c
14-1599
Скорбящий
2003-08-13 18:56
2003.09.01
Ура!


14-1611
Veliar
2003-08-13 17:43
2003.09.01
Повисает Дельфи


9-1269
Mef88
2003-02-28 17:10
2003.09.01
Навороченная прозрачность


1-1460
Layner
2003-08-18 15:17
2003.09.01
Мастера, подскажите! есть поток, при нажатии делает опр. действия


14-1641
Best Guns
2003-08-12 17:50
2003.09.01
Ищу компонент для TCP соединений