If your IP is using a Microsoft Component Object Model (COM) object, you should perform the CoInitialize call during CONNECT and call CoUninitialize during DISCONNECT. In a local configuration, a client application may already have called CoInitializeEx with a specific thread model. In this case, CoInitialize returns an error RC=RPC_E_CHANGED_MODE which means that COM has already been initialized on that thread. The IP should keep a flag for each connection indicating whether a successful CoInitialize was performed so that it can call CoUninitialize during DISCONNECT.
For information on the Microsoft COM CoInitialize function, visit: