LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

datasocket unreliable server connection, or ... ... ?

Hello all,

Background information
I am using CVI to build small acquisition software for use in-house. These are often optical measurements, that take many hours or even a few days, and that have to be done in the dark. So I cannot enter the room where the measurements are on-going, and I want only limited or no remote connections with the possibility of disturbing the measurement. Therefore I selected datasocket that is available within Labwindows/CVI.
I build a two-part software tool, based on the CVI code-samples for datasocket. One tool sends data to a datasocket-server, the other tool retrieves data from the data-socket server. The datasocket server is to me a kind of filter programme that keeps the remote users away from my quick-and-dirty measurement software.

Application information
I made a general-purpose source (dswritebmp) with three functions that can be inserted in any CVI project. With these three functions I can export a bitmap from a panel to a localhost datasocket server. Typical the size of the bitmap will be from 100 kB to 500 kB. But with an update frequency of once in a few minutes, this will not claim much resources on memory nor network utilization.
The source, dswritebmp.c and dswritebmp.h, are added to this message. Also added are a source and an UIR file that show the use if these three functions and that I use for testing.

I made an application dsreadbmp.exe for me and my colleagues office computer. It can access the remote datasocket server and retrieves and displays the bitmap from the exported panel. So if this panel contains updated information on the measurement progress, multiple users can track this progress.
The reader is not automatically updated. However my writer sends an update to the server with each new bitmap, and the server sends an update-call to the reader.
The source and UIR for the reader are added to this message. Also added is an ini-file. This file contains a few datasocket URL's. If you are using this reader, you can enter the URL for computers in your network through this ini-file and a ring-selector, or you can enter the URL manually.

Problem information
And now my problem: at irregular intervals the reader does not get anymore the update-call. Mostly the connection can be restored with (re-) connecting to the server but I want to know the cause and risk that this happens. Especially I do not want any risk that the server does see a continuing connection with the reader, and that re-connecting will increase the number of computers.
If you use the reader software, you will see two status lines: the top line is a message with a new bitmap; the bottom line is a separate timer the only checks the connection. While the reader does not get the update-call, the second line does not show that the connection has failed.
Additional to this connection failure: at irregular intervals the server does not see new data that has been send by the writer. This happens much less frequently than the above failure. But as this will be running inside a measurement programme in a dark room, I will not be able to correct this failure.

Questions
Has anybody experienced an unreliable connection with the datasocket server from CVI 6.0? If so, what can I do to improve the reliability and/or what can I do on checks and reconnect without disturbing the other part of my tool?
Who likes this idea for sending bitmap copy from a panel as a general-purpose tool, and wants to test-run it at his/her own computer? Be free to use the source code. Just make a new project for each of the two tools and add the files from one of the zipped zip-files. But please post a message that you have run it with reader and writer at two computers ie remote connection, for more than 60000 data packages, and at a 5 sec interval without failure. Or post a message that you experience the same problems. (The writer has an timer for this test.)
Is there anybody who has nothing to do at a rainy afternoon, and has some experience with datasocket programming? Please check my source on bugs i.e. failure to free allocated memory, writing beyond buffer space, or otherwise?
Are there more tools than the datasocket server/manager/help that are part of CVI full development? Are there special tools for the server to check on datasocket content, connected computers, and connection and datapacket statistics ?


Thanks for any help,
Jos
0 Kudos
Message 1 of 3
(3,354 Views)
Hello all,

To those who want to try the source:
I found a bug in one of the last add-on routines for checking the connection.

In the source dswritebmp.c at line 145, an equal-sign is missing in the while-statement that should be
while ((i < 300) && (iConnect == 0) && (Status >=0))
In the same while-loop, a line has to be added to increment the counter i
i += 1;

I noted this bug while testing the software on a slow computer ie one with problems to start the datasocket server. I also noted that the counter in the above while-loop is too long for my limited patience. So in my own source, I will reduce it to (i <100) ie the maximum delau becomes 100*0.01 sec


Regards, Jos
0 Kudos
Message 2 of 3
(3,338 Views)
Hi JGS,

There is a bug in DS_OpenEx() that will cause it to report a successful status code when there are actually connection timeout errors. I noticed that you are only using DS_Open(), but can you indicate whether you get successful status codes when you connection is "chopped"? Perhaps it could be related. Otherwise, is there any other network issues that could be causing the interruption (the IP address lease from a DHCP server expiring, etc.)?

Orlan
0 Kudos
Message 3 of 3
(3,309 Views)