Professional OPC
Development Tools


Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Connect, Reconnect

12 Jun 2015 11:00 #3213 by support
Replied by support on topic Connect, Reconnect
Any code that makes COM calls should start by calling CoInitialize[Ex] (or OleInitialize). This is a general COM thing, nothing specific to QuickOPC. And, the caller is responsible for doing it.

Under some conditions (main thread of the application), Delphi does this for you, in other cases (such as making COM calls from new threads), you simply have to do it yourself. I suggest Googling for advice: .

It can also work the other way round, on tear down: When some code calls CoUninitialize on a thread, then further COM calls may have problems, too. And, because there can be "smart pointers" that call IUnknown::Release() when they are destroyed, one must be careful to release all such pointers before the CoUninitialize call is made.

As to the "cable disconnection" issue: The expected behavior is that the component will give you errors for some time, will try reconnecting periodically in the background, and then things start working again. It could also block for some time, but not for ever. In which method is the execution "blocked"?

S pozdravem
Zbynek Zahradnik

Please Log in or Create an account to join the conversation.

11 Jun 2015 10:43 #3208 by Slabý
Connect, Reconnect was created by Slabý
I use your product QuickOPC for software development in Delphi language. I would like to ask you for one problem solution.

I develop software application for motor controlling. Application is based on your COM object imported to the Delphi as class TEsayUAClient. I use instance of your component as field in my own class which encapsulate the client functionality (TMTFControler). In constructor of the TMTFControler I create object of the COM:


and then I use OPCClient in other thread. When I don't call method Connect (OPCClient.Connect) then I receive exception ( class EOleSysError with message 'Nebyla volána procedura CoInitialize'). I see your example named ReadandDisplay and you don't call this method.
Sometimes error occurs when I close my application and I call procedure Connect in constructor of my class :

constructor TMTFMotorsController.Create;
OPCClient:= TEasyUAClient.Create(nil);

destructor TMTFMotorsController.Destroy;

My next questions is about reconnect to the server. When I disconnect my UDP cable and I try read value from OPC then I receive exception:

First chance exception at $764BC44D. Exception class EOleException with message 'An OPC-UA operation failure with error code -2138701824 (0x80860000) occurred, originating from 'Opc.Ua.Core'. The inner OPC-UA service exception with service result 'BadSecureChannelClosed' contains details about the problem'. Process MTFMotorDriver.exe (5992)

In this case I detect problem with my cable. When I connect the cable and I try read some value then my application is freezing. I read some discussion on your forum about times of session, but I wasn't successful.
Thanks you for any advice.

Best regards

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.057 seconds