07-20-2005 09:00 AM
I can’t get datasockets working on our latest laptops. I am using CVI 7.0.0 (393). The major difference in the systems is the new computer is running WindowsXP Professional with SP2 vs. WindowsXP Professional with SP1 on our existing systems. I’ve tried a couple of apps that we are currently developing and when they didn’t work fell back to the “Writer” sample project with a few printf() calls to see what’s happening. Here are the details:
On both systems all of the DS_ functions return error code 0, (success). The DataSocket Server application opens normally. On both systems the UPDATEDSTATUS event occurs two or three times after the DS_Open and the status message reports "Connecting: Parsing URL".
On the working systems the next status message is "Active: Connected".
On the newer systems the next status message is "Error: Not connected. Connection refused. No applicationon the host machine to service the connection.".
There is a lot I don't know about data sockets but I have been using them with no problem for a couple of years now. On the failing machine I have installed datasockets and checked the configuration. For troubleshooting in case something was still missing I installed CVI 7.0 - no change.
Any suggestions would be appreciated.
07-20-2005 09:56 AM
Hi DannyM,
This may be related to a bug in DataSockets that I saw back in January. If a DS client attempts to connect to a DSS that isn't running or that can't respond (because Window Firewall is running and it isn't exempted), then DS_OpenEx can return a success code--zero--even though the connection actually failed. This is especially true if a timeout value is used. Subsequent calls to DS functions resulted in errors similar to what you said, basically hinting that DS_OpenEx never actually succeeded in getting a connection. This sounds kind of close to what you may be describing.
This bug is specifically related to newer versions of the DS libraries. You may need to see if your XP SP1 installs have an older version of DS. If they are the exact same version, then there must be some other problem. I know that enabling Windows Firewall is a big part of SP2, so make sure that this is not gumming up the works.
If the versions on the SP2 systems have a newer DS library, then you could be seeing the bug. It is being repaired and will be distributed in the next release of DS. In the meantime, the suggested NI workaround is to use DS_GetLastError after DS_OpenEx to determine if it was lying to you. One problem that I have with it is that if one function will lie to me, then I don't trust any DS functions--not just DS_OpenEx. This is the first return value in CVI that I have ever seen behave like this. So, I had to rewrite several of my recent distributions that use DS with the get last error re-check to determine when the DS library was lying to me. Even DS_GetLastError doesn't report the timeout as a timeout, but atleast it will report an error code other than success. What else can you do? I have older DS deployments that will report the timeout correctly, especially those installed with older CVI 6 executables, and the timeout error did not occur in them. So, somewhere between when CVI 6 and when CVI 7 was released this functionality was broken. Neither I nor NI went to the trouble to find exactly which version broke it, but NI was able to duplicate it on several machines at their own tech support facilities.
Orlan
07-20-2005 01:41 PM
Thanks for the feedback. It sounds like I may be seeing a different case of the bug you mention.
In my case both OS versions, SP1 and SP2, are using DS ver. 4.2(1). The system with SP-2 does have the firewall turned off; both the Windows built-in one and a third party firewall that came with the anti-virus software. The anti-virus s.w. is also turned off while I try to solve this. The DS Server does open, and I do check the messages - that's where I get the "Parsing URL" message and the "Active: Connected" or "Error: Not connected...." messages mentioned above. This problem not only happens every time I run any DS program but if I create a loop on error that leaves the server running and try again to connect, (with appropriate delays and cleanup), it still fails every time. I should also note that at this stage the DS server and clients applications are all running on the same machine.
NI - any estimate when the bug fix mentioned above will be released?
07-20-2005 02:11 PM
Additional data:
I have been using the asynchronous DS_OpenEx. If I use a timeout value instead, (no mater how large), I get a timeout error from the DS_OpenEx. I assume this mean the dsHandle is invalid and my callback is never registered because in this scenarion I don't get the "Error: Not connected..." message or any other status messages. On the working system the open works with even a 1 ms timeout.