LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert Refnum to another datatype?

Hello

I have this application which is using a telnet connection to collect data from our DUT at regular intervals. There is an error trap such that if the connection is lost, a new connection will be established automatically.

We are logging various data to a time-stamped CSV file already, and now we want to add another piece of data - the refnum of the telnet connection. this way, we can see if and when the connection is dropped/reestablished by the change in the refnum. However I can't figure how to convert the 'refnum' wire into something I can write to a spreadsheet file, such as a DBL..

Can this be done? Better suggestions are also quite welcome!

Thanks
Jason
0 Kudos
Message 1 of 3
(2,642 Views)
Jason,

You could feed the refnum into a Type Cast node (Advanced >> Data Manipulation) and cast it into a U32. I doubt that this number is guaranteed to be different with each connection, but maybe it will be in practice.

I would suggest an alternative approach of updating a state variable of some kind with a time stamp each time the connection is established/reestablished. Write that value to your logfile. Then, if you do run into a recurring problem, you can easily do some investigation to see whether a dropped connection is happening in conjunction with some scheduled event on one of your machines (e.g. virus scan kicking in at 4 AM, etc).

Regards,
John
Message 2 of 3
(2,629 Views)
Thanks for the suggestions.. I had actually tried the Type Cast already, but I hadn't applied a U32 to it. Everything else I had tried gave me '0' for output all the time. Now it works, thanks.

The entries in the logfile are already timestamped, so if a change occurs in the refnum we will know exactly when it happened. I think it is safe to say that the refnum value will be 'serially unique', in that no two consecutive refnums will ever be the same, although non-consecutive refnums may be. This is good enough for our purpose.
0 Kudos
Message 3 of 3
(2,603 Views)