LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GET VI not "uploading" the information gotten from the web server

Hello,

 

I am trying to make a simple VI where I get the digital value of a microcontroller port updated on a web server. I used the GET VI of HTTP Client palette but it only gets the body of the web server once so when I drop the port from 1 to 0 for example it didn't appears on LabVIEW. 

 

That's pictures of how I did it and the VI file is attached.

print1.png

print2.png

 

Probably it's caching but I don't have idea how to solve it, can anyone help me please?

 

 

0 Kudos
Message 1 of 5
(3,478 Views)

I did not check too close your VI, but 3 things I noticed (but it is not totally clear what is on the server side...):

  1. you do not use error handling, stop the loop if error happens (use logical OR for the Stop condition and error condition)
  2. your loop is iterated as fast as the CPU can do. Put a Wait function in the while loop, like 100 msec...
  3. You set the Get VI never time out. You should use some other value here to detect if no incoming info...

 

Message 2 of 5
(3,446 Views)

Thank you, fixed the error thing and tried to set a time wait to delay but still it only gets the first data from the web server page but if the data changes the VI doesn't get it. I tried a block from http client palette (Add Headers I think) to control cache but nothing, also tried to change it to DataSocket as DataSocket Read block has an option to apply DataSocket Update when new data comes but just realized it doesn't work for http so no deal. It seems to be requesting the data only once so what can I could think is to creat a logic to keep sending the URL to conncetion time to time but if it doesn't work  I will probably just change strategy since I don't think will be a problem it not being real time (it was preferable real time but well) since the web server itself isn't that fast to upload itself (I used the max baud rate I could for my microcontroller doesn't bug though), just will try to store all the data on the web server before getting it to LabVIEW, so when I use the VI it won't matter to get the body of the page only once.

0 Kudos
Message 3 of 5
(3,387 Views)
Does the webserver continually update with new values while the page is open? If you 'refresh' the page, does it reset back to 1 value?

If so, it probably does a buffered connection where it keeps the HTTP request open and keeps writing to it - I don't know how/if this is supported in the LabVIEW HTTP Client VIs. It might also be using javascript to get new/update the values but without knowing what the microcontroller is doing and/or what the web-page is doing, it is difficult to tell.

You might want to use the TCP/IP VIs to open a connection, send the HTTP GET request yourself, read the header data and then keep reading the new values from the socket.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 5
(3,374 Views)
One problem is that you aren't getting back a complete -- or even valid -- response. In the HTML there is no <body> tag and the string that is there leaves an <h2> tag open, which makes it look like something is getting truncated.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 5
(3,369 Views)