Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.014 c
14-1608
Marser
2003-08-13 00:15
2003.09.01
Именинники 13 августа


1-1488
Maks Realov
2003-08-14 15:14
2003.09.01
Неясное поведение Delphi при работе с указателями типа PChar.


3-1291
Алексей Петухов
2003-08-11 08:40
2003.09.01
Удаление и восстановление записей в таблицах Visual DBase 7


1-1486
lex7
2003-08-18 13:27
2003.09.01
try...except...end;


3-1306
The X
2003-08-07 13:32
2003.09.01
Возможность создания многостраничного отчета без данных из БД




   Наверх