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