System.reboot() Done Remotely W/daqconnect?


Recommended Posts

Hi again,

Before I get going with creating my own dll files, I want to restart a runtime computer remotely, using daqconnect.

My problem is that users do not moniter if the document is uploading to the internet. I know that in web settings you can view uploading, but that does not persist when the doc is opened in runtime. Is it possible to have a pop-up message for when the document 's computer does not have an internet connection, and so cannot-is not uploading to daqconnect?? Is there a system.connection function for internet connecdtivity. But since the remote is not conneceted, I suppose I wouldnt be able to restart the computer remotely with daqconnect anyway.

So, I guess I want/need a popup for DF document that tells the remote user that the PC running DF does not have an internet connection.

Is there a way to display a message when there is no internet?

Also-I would still like to be able to reboot a computer-when it does have an internet connection, using daqconnect.

Thanks-Daqfactory is a great product.

Link to comment
Share on other sites

I'm not quite sure what your questions are, so I will attempt to answer what I think they are:

1) alert a remote user when you DF connection doesn't have internet: for this, if you are using DAQConnect, you can just create a data age alarm on one of the tags coming from DAQFactory. The data age alarm in DAQConnect triggers when the DAQConnect server hasn't received a new data point in a certain amount of time. You can then have the server email you when the alarm triggers.

2) remotely reboot: for this, you would use the control capabilities of DAQConnect, probably with full security enabled. "Control" is loosely defined in DAQConnect and for that matter DAQFactory. When a control command arrives from DAQConnect, it simply triggers a sequence in DAQFactory. That sequence can do anything, including system.reboot()

3) display a message locally when internet is lost: first, I don't recommend a popup, unless its popping up a DAQFactory page. This is because system.messageBox() and other system windows can't be closed in script. A popped up page can, so you can hide the popup when internet is restored. To determine if you have internet requires you to ping some known site. You can use the http.get() function for that. If the function fails, or doesn't return what you expect, than you don't have internet. Note that some ISPs (such as ours) for some reason will display their own search window if it can't find a URL, rather than generate an error.

Link to comment
Share on other sites

http.get("www.daqconnect.com")

but you aren't looking for it to == 0, you are looking for an error (which you'll have to catch), or a wrong page. Telling if you got the right page is tough since the DAQConnect home page may change. You could check to see if your ISP redirects by doing http.get("www.jdsiuaserd.com") or some other invalid address and see if you get an error, or some text response. Also, sometimes you can't get to pages for no particular reason. For example, I just tried the above line and got an error even though the daqconnect site is up. I repeated it and it worked fine. You've seen it before I'm sure for any site. You browse to the site and the browser spins, but when you hit refresh it comes right up. This is usually because some server along the line of the original connection reset the connection before the full page was downloaded.

Also, do NOT ping the DAQConnect server every second. You will likely get booted as a DoS attack, not to mention networking lags could make it quite a bit longer anyway. Once a minute is probably a minimum. So, your script might end up similar to:


private failCount = 0
private string DataIn
while(1)
try
datain = http.get("www.daqconnect.com")
if (getLength(datain) < 1000) // assume if short than invalid
failcount++
else
failcount = 0
endif
catch()
? strLastError
failcount++
endcatch
if (failcount > 3)
system.reboot()
endif
delay(60)
endwhile

[/CODE]

Link to comment
Share on other sites

? strLastError prints the error that caused the catch() in the command/alert window. I pretty much always put one in my catch() block, at least initially, so if there is a typo or something that generates an unexpected error, I can actually see it happening in command/alert.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.