KenMandile Posted March 3, 2014 Share Posted March 3, 2014 Is there a code for verifying that my remote is connected to the server? I would like to display a message on the remote copy to show that it has disconnected from the server so that someone viewing the data will no that it is not updating. I would also like the remote copy to try to reconnect when it disconnects. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 3, 2014 Share Posted March 3, 2014 There is no direct code, but its pretty easy to write script to check it by looking at the time stamps: global connected = 0 private lasttime = systime() private lastChanTime = systime() while(1) if (!isempty(remote.mychannel.time[0]) if (lastChanTime == remote.myChannel.time[0]) connected = (systime() - lasttime) < 30 else lasttime = systime() lastChanTime = remote.myChannel.time[0] endif endif delay(10) endwhile Its a little tricky only because you can't assume that both computers have the correct time. If you use the time stamp on the data point (which is the remote PC's time) and compare it to the time on the current computer, its possible that even though in real life they are close, the numbers show a big difference because the computer times are not in sync. Link to comment Share on other sites More sharing options...
SteveMyres Posted March 3, 2014 Share Posted March 3, 2014 Have the base machine export its time in a channel and have the remote sync on DF startup, or have both machines set their time via some NNTP server. I don't know if that change will be effective during the DF session when it's done, but as long as you're not running 24/7/365,it doesn't matter, the two machines will stay reasonably synced. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 3, 2014 Share Posted March 3, 2014 NTP time changes won't affect DAQFactory until a restart unless you are using the usertime.dll, and that has its own issues. There's no reason to export the time as a separate channel as any new data point channel will have the server timestamp on it anyway. Really, its just a matter of remembering not to assume the times are synchronized and only compare times from the same machine. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.