WSACleanup, WSAStartup in Klasse möglich
-
Hallo Leute,
ist es möglich die WSAStartup() in den Konstrucktor und WSACleanup() im Destruktor einer Klasse zu verwenden.
die Frage ziehlt daruaf hinaus was passiert wenn zwir instanzen der Klasse erzeugt werden und danach eine wieder zerstört wird. Funktionieren die Socket funktionen dann noch?
MfG
-
Steht in der Doku von WSAStartup
http://msdn.microsoft.com/en-us/library/ms742213(VS.85).aspxAn application must call the WSACleanup function for every successful time the WSAStartup function is called. 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.
und WSACleanup
http://msdn.microsoft.com/en-us/library/ms741549(VS.85).aspxThere must be a call to WSACleanup for each successful call to WSAStartup. Only the final WSACleanup function call performs the actual cleanup. The preceding calls simply decrement an internal reference count in the WS2_32.DLL.
-
danke