Has anyone tried reading and writing data to/from COM ports in webpages. I am running Apache webserver. Could anyone one suggest me about what scripting should I use to access data in html pages from COM ports on the system ?
Thanks
Has anyone tried reading and writing data to/from COM ports in webpages. I am
Share
There is currently no way to do this directly from HTML 5 (except perhaps for maybe on the blackberry tables OS or BB10 using webworks (would also be client side), but I have not personally tried this). If you are trying to read serial data on the server and showing the result in an HTML document it’s quite easily done using javascript to sent post requests to your web-server. doing the work on the server and responding, and interpreting the server’s response in the javascript.
There’s lots of online guides for sending post requests from javascript asynchronously, for instance: JavaScript: Sending POST, redirecting to response.
On the server side, lots of options available. You can use PHP-serial to read serial data: http://code.google.com/p/php-serial/, or if it’s not a PHP server there are libraries available for most languages. Or, if you don’t like PHP-serial you can use your server language to call another executable/script on the system to do the serial reading (that external program can relay the read data via stdout or file output). Either way, the webserver can then respond to the HTTP request simply by printing out the data, and your client-side javascript can read the response body to retrieve that data.