urdey Posted July 2, 2018 Share Posted July 2, 2018 How to send devices data to web browser using html javascript from DAQ FACTORY Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 5, 2018 Share Posted July 5, 2018 That really depends on the web server. Are you going to use DAQFactory as a webserver or send data to another webserver? By far the easiest method is to use DAQConnect (daqconnect.com) Quote Link to comment Share on other sites More sharing options...
urdey Posted July 21, 2018 Author Share Posted July 21, 2018 My main intention is to display DAQ HMI Screen in the website or webserver and few javascript code action from webserver to DAQFACTORY HMI Start and Stop process. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 28, 2018 Share Posted July 28, 2018 Your best bet would be to use a service such as DAQConnect.com to do this. With that product you'd have to create separate HMI screens for the web, but they will work more efficiently and across all devices. Alternatively, you could program DAQFactory to take screenshots of pages, then upload them to a webserver. Sending commands back to DAQFactory would be slightly harder, but is best implemented using a pull mechanism, meaning DAQFactory queries the server at some interval to see if there are commands to perform. You do not want to open up the system running DAQFactory to the Internet as that is just asking for security problems. Not because DAQFactory is more insecure than anything else, but because opening up the system to the Internet exposes the system to attacks on all levels, the most likely being on the OS and probably DoS type attacks (even if they are unintentional). Quote Link to comment Share on other sites More sharing options...
urdey Posted November 1, 2018 Author Share Posted November 1, 2018 How and what command DAQFACTORY will take screenshots of pages then upload command them to a webserver.What DAQFACTORY queries commands the server at some interval through xml or json from webserver. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted November 1, 2018 Share Posted November 1, 2018 Screenshots are done with: page.capture() Uploading can be done through the FTP. commands, or possibly other solutions (shell commands?). Depends on what you are doing. Download data from the web is done with: http.get() Note that most of these functions require DAQFactory Pro. Quote Link to comment Share on other sites More sharing options...
urdey Posted November 2, 2018 Author Share Posted November 2, 2018 DAQFactory can it support PUT,POST ,DELETE command like GET command?. How Data will be transferred in JSON or JavaScript format from DAQFACTORY to website Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted November 15, 2018 Share Posted November 15, 2018 At present it only supports GET. Quote Link to comment Share on other sites More sharing options...
urdey Posted December 13, 2018 Author Share Posted December 13, 2018 After setting Real time Web Access as localhost .and while connecting showing error using from Daqfactory but in local browser local host works . Why I can not connect local host form daqfactory Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 14, 2018 Share Posted December 14, 2018 Not sure where you are going with this. The Real Time Web feature only works with the DAQConnect service and their servers. You can't point it to your own computer as you don't have a DAQConnect server. How did you get the Object Not Found errors? What Help file were you trying to look at? Quote Link to comment Share on other sites More sharing options...
bms Posted May 24, 2023 Share Posted May 24, 2023 I have a webserver running locally that I'm trying to hit using HTTP.Get("127.0.0.1", "/optimize", 5000) or HTTP.Get("localhost", "/optimize", 5000), but I keep getting "HTTP Error: A connection with the server could not be established." I can access the server with a web browser (127.0.0.1:5000/optimize or localhost:5000/optimize). Is there a reason why DF can't find localhost, or am I doing something wrong? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 25, 2023 Share Posted May 25, 2023 Are you sure it is not a secure connection? I can't tell since you are using a non-standard port. Quote Link to comment Share on other sites More sharing options...
bms Posted May 25, 2023 Share Posted May 25, 2023 Yes, definitely not secure. Via the browser https://localhost:5000/optimize throws an error, but http://localhost:5000/optimize serves correctly. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 25, 2023 Share Posted May 25, 2023 I can't say. Your syntax looks fine. HTTP.Get() calls a Windows API function and the error message you are seeing is coming directly from that function. I am thinking maybe there is some sort of firewall setting that is making it not work? You could try just creating an Ethernet Client connection and see if you can get a response. Usually, once you have connected to the IP address and port, all you need to send is: GET /optimize HTTP/1.1\013\010\013\010 where \013\010 is carriage return / line feed and what you would type in the Monitor Window. If you get "Port is busy" then DAQFactory couldn't open a socket to the server and I would say you definitely have some sort of security setting that is allowing the browser to access it, but not DAQFactory. Quote Link to comment Share on other sites More sharing options...
bms Posted June 8, 2023 Share Posted June 8, 2023 Still scratching my head here. If I send GET /optimize HTTP/1.1\013\010\013\010 I correctly receive HTTP 200. If I deliberately send something wrong EG GET /abc HTTP/1.1\013\010\013\010 I correctly get a 404 not found. Same for GET HTTP/1.1\013\010\013\010; 404 Not Found But HTTP.Get("127.0.0.1", "/optimize", 5000) gives the "a connection to the server could not be found" error. There is also no traffic captured on wireshark What is strange is HTTP.Get("127.0.0.1", "", 5000) does correctly return a 404 error and I can see it in wireshark. Does HTTP.Get() do any formatting before sending to windows? Quote Link to comment Share on other sites More sharing options...
bms Posted June 8, 2023 Share Posted June 8, 2023 Another question if you will entertain me. I'm using a DLL at the moment to get around the issue, but it is a bit inconvenient that DF blocks while the function is running (i have to call it fairly regularly, and takes around 5 seconds to compute). Is there a way to call DLL functions asynchronously? "DLLGlue.dll": #include <stdlib.h> extern "C" { __declspec(dllexport) char RunApp(char *command) { return system(command); } } Then in DF: extern(OPT.OptimiserLocation + "DLLGlue.dll", "char RunApp(string)", "OptRunApp", "stdcall") OptRunApp("cmd /C python " + chr(34) + OPT.OptimiserLocation + "query.py" + chr(34)) Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted June 8, 2023 Share Posted June 8, 2023 First part: http.get() just uses the OpenURL() function of the MFC CInternetSession class. It is a pretty dead simple wrap of this function. https://learn.microsoft.com/en-us/cpp/mfc/reference/cinternetsession-class?view=msvc-170. DAQFactory will automatically add http:// in front. It will also add :5000 to the end. For the path, if you don't start with / it will add it for you. Note you should see an error message in the command alert if it fails. Are you not getting one? As to the second question, first, are you just trying to run a command line? If so, why don't you just use system.shellExecute()? There is no reason to right a DLL. System.ShellExecute() does not block, which, actually is the only reason I can think that you would want to create a DLL to wrap it. There are cases when you want to run a shell program, and then likely you piped the result to a file that you can then read into DAQFactory. If you don't block you have to use other tricks to make sure it is complete. Anyhow, to your original question, you can make pretty much anything non-blocking in DAQFactory by simply putting it in its own sequence or thread. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.