- WSAStartup((1 << 8) | 1, &wsaData);
- win_initialized = 1;
- }
- internal = new wxSockHandlerInternal;
- internal->sockWin = ::CreateWindow(wxPanelClassName, NULL, 0,
- 0, 0, 0, 0, NULL, (HMENU) NULL,
- wxhInstance, 0);
-
- // Subclass the window
- if (!wxSocketSubClassProc)
- wxSocketSubClassProc = MakeProcInstance((FARPROC) wxSocketHandlerWndProc, wxhInstance);
- ::SetWindowLong(internal->sockWin, GWL_WNDPROC, (LONG) wxSocketSubClassProc);
- ::SetWindowLong(internal->sockWin, GWL_USERDATA, (LONG) this);
-
- internal->firstAvailableMsg = 5000;
- smsg_list = new wxList(wxKEY_INTEGER);
-#endif
-
- socks = new wxList;
-
-#ifndef __WINDOWS__
- signal(SIGPIPE, SIG_IGN);
-#endif
-}
-
-// --------------------------------------------------------------
-// --------- wxSocketHandler DESTRUCTOR -------------------------
-// --------------------------------------------------------------
-wxSocketHandler::~wxSocketHandler()
-{
- wxNode *next_node, *node = socks->First();
-
- while (node) {
- wxSocketBase* sock = (wxSocketBase*)node->Data();
-
- delete sock;
- next_node = node->Next();
- delete node;
- node = next_node;
- }
-
- delete socks;
-
-#ifdef __WINDOWS__
- delete smsg_list;
-
- ::DestroyWindow(internal->sockWin);
- WSACleanup();
- win_initialized = 0;
-
- delete internal;
-#endif
-}
-
-// --------------------------------------------------------------
-// --------- wxSocketHandler registering functions --------------
-// --------------------------------------------------------------
-void wxSocketHandler::Register(wxSocketBase* sock)
-{
- wxNode *node;
-
- for (node = socks->First(); node != NULL; node = node->Next()) {
- wxSocketBase* s = (wxSocketBase*)node->Data();
-
- if (s == sock)
- return;
- }