Форум: "Сети";
Текущий архив: 2003.09.01;
Скачать: [xml.tar.bz2];
Вниз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;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.011 c