LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

From within my application can I determine the number of processes connected to the DataSocket Server?

I am writing two applications that communicate using DataSocket. I want to be able to start either application first so I am launching the DataSocket server from both applications. The problem comes in when I start up the reader first. Without the writer started he gets a DS_EVENT_DATAUPDATED event that contains data that I want to ignore. Is there a way to determine the number of processes connected to the DataSocket server from my application. If the number is just 1 then I can ignore this data.
0 Kudos
Message 1 of 3
(2,937 Views)
There is no way to pole for the number of current connections. What you could do is ignore the first update if it is not valid. If there is no connection then it returns that the item is an integer with a value of 0. You could check type with DS_GetDataType and value with DS_GetDataValue and ignore the update if the first update is a integer (type = 103) and has a value of 0.

If that doesn't work for you because the item actually is an integer and 0 is a valid potential value, then you could have another solution. You could have another dataSocket item that is used to store the number of writers connected and each time a writer connects is adds one to the value of that socket. Then your reader programs could check that DataSocket item to see if writers a
re connecte

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(2,937 Views)
Chris,

Thanks for your input. Originally I only had a single integer being passed so that the first 0 value was legitimate. I have now added more data so I am now passing an array and I can reject the initial value because it is not an integer array as you pointed out.

Thanks,
Jim
0 Kudos
Message 3 of 3
(2,937 Views)