LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save data (.txt) in LabVIEW and access it from the web using LabVIEW server

I'm using a LabVIEW application and publish that on the web using the web publishing tool. In my application, it is possible to sava data in .txt format. I do that in a folder called "saved" inside the www folder, so i can access the data from the client side (http://hostname/saved/file.txt). The problem is that i need to stop the application first to view the .txt file from the client. That is something that didn't happen before with the LabVIEW6.1. The application was developed with LabVIEW 6.1. Is that the problem? is there something different with the LabVIEW 7.1 server?
Thanks
Luis
0 Kudos
Message 1 of 4
(3,068 Views)
Salutations,

I'm taking a bit of a shot in the dark one this one, I'm afraid. However, you must be opening the file, writing to it, but are you also making sure you then close the file? It sounds like labview is still using the file and thus you're not allowed to access it unless you stop the program. So, if you close out the file after you write to it, I'd imagine you're able to open it.

It's a guess, sorry I can't be more helpful.
ElSmitho
0 Kudos
Message 2 of 4
(3,064 Views)
It's a good suggestion and i tried to close the file but what i do, is create a .txt file and append data to it every sample. I cant really close it. Actually, if i go to the server, i can open the file, so it has to be something with the server.
Thanks anyway
0 Kudos
Message 3 of 4
(3,056 Views)
Luis,

I can't test it with 6.1, but I suspect you're right about there being a change in the HTTP server behavior. In 7.1, anyway, it looks as if LabVIEW keeps track of open file refnums and throws an Internal Error 500 if a client asks the HTTP server for a file that is currently open in LabVIEW.

I don't know why the server would have to do this, and maybe there's some flag or configuration setting that could be tweaked to adjust that behavior. I'm not sure.

In general, though, I think ElSmitho's suggestion is the simple answer here. Can't you adjust your file I/O code so that you close the file between write operations? You said you couldn't close it, but unless you're writing data at a very high rate, opening and closing for each update shouldn't cause any real performance issues. If you do the I/O this way, you should find that the Web server doesn't throw the error anymore, or at least throws is very infrequently, when there happens to be a request during the very brief period when the VI is writing data.

Regards,
John
0 Kudos
Message 4 of 4
(3,044 Views)