[omniORB] ActiveX

Steven W. Brenneis brennes1@rjrt.com
Thu, 09 Sep 1999 08:44:04 -0400


Sai-Lai Lo wrote:
>=20
> >>>>> Steven W Brenneis writes:
>=20
> > First, Steve painfully admits he hasn't had time to look at the 2.8.0
> > prerelease for NT.
>=20
> > With that out of the way, have you added a call to WSACleanup to the =
NT
> > implementation of the BOA::dispose member?  This call cleans up inter=
nal
> > WinSock memory allocation (and makes the Purify leak report easier to
> > read).  I have been adding this call externally to my applications wh=
ich
> > then requires me to link with ws2_32.lib.
>=20
> > I have been intending to report this for quite a while but my attenti=
on
> > was diverted elsewhere.
>=20
> OK. I think the new method ORB::NP_destroy() is the more appropriate fo=
r
> 2.8.0. I'll add the WSACleanup call.
>=20
> What effect does the call has on sockets that has not been closed?
>=20
> Sai-Lai
>=20
> --
> Sai-Lai Lo                                   S.Lo@uk.research.att.com
> AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att=
.com
> 24a Trumpington Street                Tel:   +44 1223 343000
> Cambridge CB2 1QA                     Fax:   +44 1223 313542
> ENGLAND

Sai-Lai,
I have included the VC help text for WSACleanup:

An application or DLL is required to perform a successful WSAStartup
call before it can use Windows Sockets services. When it has completed
the use of Windows Sockets, the application or DLL must call WSACleanup
to deregister itself from a Windows Sockets implementation and allow the
implementation to free any resources allocated on behalf of the
application or DLL. Any pending blocking or asynchronous calls issued by
any thread in this process are canceled without posting any notification
messages, or signaling any event objects. Any pending overlapped send
and receive operations (WSASend/WSASendTo/WSARecv/WSARecvFrom with an
overlapped socket) issued by any thread in this process are also
canceled without setting the event object or invoking the completion
routine, if specified. In this case, the pending overlapped operations
fail with the error status WSA_OPERATION_ABORTED. Any sockets open when
WSACleanup is called are reset and automatically deallocated as if
closesocket was called; sockets that have been closed with closesocket
but that still have pending data to be sent may be affected=BEthe pending
data may be lost if the Windows Sockets DLL is unloaded from memory as
the application exits. To insure that all pending data is sent an
application should use shutdown to close the connection, then wait until
the close completes before calling closesocket and WSACleanup. All
resources and internal state, such as queued un-posted messages, must be
deallocated so as to be available to the next user.=20

There must be a call to WSACleanup for every successful call to
WSAStartup made by a task. Only the final WSACleanup for that task does
the actual cleanup; the preceding calls simply decrement an internal
reference count in the Windows Sockets DLL.=20

Hope this is helpful.