From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket DS_Open() fails with fatal runtime error

CVI: Version 7.0
OS: Windows2000

I am using datasocket to get data from a device
using HTTP protocol periodically (say every 5 minutes).
DS_Open() fails with fatal run-time error after 1056
cycles and I got the dialog box with following error
message.
Title: ComponentWorks
Message: Error Creating default control


Any idea why this is happening?

Thanks for your help!
Mano
0 Kudos
Message 1 of 6
(3,257 Views)
Hello


Is it always the same number of cycles? Do you have some sample code I could try this with on my system. Make sure that you are closing all the datasocket resources by calling DS_DiscardObjHandle().

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 6
(3,257 Views)
Hello Bilal,
Yes it always fails after 1056 cycles.
I did use DiscardObjHandle() to close the
DataSocket handle.

I am attaching the sample source code for
you to try.

Let me know about your findings.

Thanks for your help!
Mano
0 Kudos
Message 3 of 6
(3,257 Views)
I think this is happening because DS_Open doesnt actaully wait for the connection to fully go thru before it returns. Instead of using DS_Open, use DS_OpenEx to wait until the connection is made, like the following:

hr = DS_OpenEx ("http://www.ni.com", DSConst_ReadAutoUpdate, NULL,
NULL, DSConst_EventModel, DSConst_InfiniteTimeout,
&handle);

So this way, you know for certain that the connection was actaully made before you discard the connection. After making this change, I went upto 1700 cycles and still going strong.

Bilal
Bilal Durrani
NI
0 Kudos
Message 4 of 6
(3,257 Views)
Hi Bilal,
Thanks for the reply.
I am still having the problem even if I used
DS_OpenEx().
DS_OpenEx() fails if I set Access Mode parameter to DSConst_ReadBufferedAutoUpdate or DSConst_ReadBuffered.

Please let me know if you have a solution.

Thanks,
Mano
0 Kudos
Message 5 of 6
(3,257 Views)
Try changing the Execution model to DSConst_PollingModel.
This behavior does look like a problem and we're currently investigating this.

Bilal
Bilal Durrani
NI
0 Kudos
Message 6 of 6
(3,257 Views)