LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Attempting to detect active Clients using Datasocket functionality

My initial, non elegant, solution to this problem was to write a small sub VI (see attached file) that runs on the 'DAQ/Server' computer. This sub VI searches for other clients by looping through a list of known computers on my LAN by building the source datasocket URL - ie. on the 1st iteration, URL = dstp://Computer1/book, where

"Computer1" is the computer name on the LAN and
"book" is the DataItem.

The sub VI uses the 'DataSocket Read.VI' as the interogating mechanism to determine whether a client is connected to the DataSocket server and requesting/sending data. I set the "wait for updated value" property to "True" and set an arbitary wait interval in the "ms timeout" property.

My solution then RELIES on the 'DataSocket Read.VI' returning a FALSE value for the "timed out" property when it successfully finds the client and the DataItem on the network. If it does not find the DataItem (and by extension a matching client), it will timeout and return a TRUE value for this property.

In theory I thought this would work, however I have noticed a stange phenomenon, that I cannot explain, which causes this solution to fail. It seems that the 'DataSocket Read.VI' ignores the 'DataItem' tag in the URL that it is passed and simply searches for the computer. For instance, if Computer1 has started a process on the DataSocket Server, and the DAQ/Server machine is searching for 'dstp://Computer1/xxzzyybook'
the sub VI will indicate that it has found this item, despite the fact that this DataItem does NOT exist, and it will return an Empty/Null data value. It seems it does not matter what value I enter for the DataItem, the DataSocket Read.VI will always return a False value if ANY computer has started a DataSocket Server process. If Computer1 has NOT started a process on the DataSocket Server adn no other processes are running, the sub VI correctly returns that no client was found. My understanding of the DataSocket Read.VI is clearly incomplete. Does anyone understand why this phenomenon occurs?

Of course, there is a major time dependency introduced by this solution making it far from ideal. [The time delay is introduced since the DAQ/Server needs to search all networked computers to find active clients. I have noticed that if I start with a high "ms timeout" value (eg. 500ms) the sub VI finds the client, however if I reduced the "ms timeout" value to 100ms, then the Sub VI does not find any active clients.]

I am in search of method to dynamically identify clients on the DataSocket server. Is there a means of interogatting the DS Server to determine the active clients? Help here would be greatly appreciated. Do we have to use TCP/IP VIs?

cheers, Rob

p.s. to test my sub VI, start a VI on another machine that opens a DS Server process and publishes at least one data item to it."
0 Kudos
Message 1 of 2
(2,576 Views)
Have each computer running a process write to a DataSocket channel that is dedicated for detecting active clients. The data sent on the channel is the computer name. Since each computer running a process would write to the same channel you would have to stagger the times when they write so they won't step on each other (the delay times could be prime numbers). Then have one reader VI that reads that channel and maintains a list of unique computer names.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 2 of 2
(2,576 Views)