Solved

How to display realtime meter reading data from TCP or serial on web

Posted on 2010-09-22
5
482 Views
Last Modified: 2012-06-21
I may need to display realtime meter reading values on the web site. The data will be received by the server through TCP or serial port.

I plan to make one program A on server to receive the realtime data and pass them to web server, and save to DB also. But I am not sure how to let the program A pass the data to the web server, or through whcih way.

When the end user start a web page, all and only the meters in this page need refresh the realtime display. The web server need to pass this meters ID to program A, and A start to polling these meters realtime value with faster speed. Can this be done in the web server.

Thanks.
0
Comment
Question by:turbot_yu
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 33750222
If your "realtime" data isn't to quick, you could have your program A send data to it using a simple GET request, and create a page on the server to process the request and write the data to the database.  For example:
  program A would GET www.server.com/update_value.cgi?value1=5&value2=10
  Then update_value.cgi would write the new values to the database.

To have the web browser display the data, you could use AJAX to get new data from the web server, and update the page.


I'd guess this would work for about 1 update/second.  Much faster than this, and you'll some other method.
0
 

Author Comment

by:turbot_yu
ID: 33750381
1 update/second is fine. May you give details about GET request.

Please see the attached screen.
meter.png
0
 
LVL 39

Expert Comment

by:Adam314
ID: 33750645
In your picture, program A writes to the database, but the webserver does not interface with the database.  Is this how it will work?  If so, I misunderstood your requirements.

I thought that the program A would interface with the web server and the polling data back - not the database - and the web server with interface with the database.  If so, how you send the GET request will depend on the language.  If you are using perl for program A, you can use the LWP::Simple module, and the request is just 1 line (plus 1 line to include the module):
    use LWP::Simple;   #Include module
    #whatever code to read from polling data back goes here
    my $content = get("http://www.your-server-here.com/update_value.cgi?value1=$value1");
0
 

Author Comment

by:turbot_yu
ID: 33753902
Sorry, I forgot to draw the link from DB to web server.

Most of the data that web client want to view is not realtime data, just the data in the DB.

Actually, there are 2 kinds of data. One is trending data, which refresh every 10 mins, another realtime data, which refresh every second.

I am new to the GET. Is it from the web server? Any syntax of it.
meter-1-.png
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 500 total points
ID: 33758163
GET is one of the methods a web client communicates with a web server.
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

This is what is used when you type an address in a web browser - the web browser sends a GET request to the web server, and the server responds with the data for that page.

On the web server, if the page is just plain html, the web server will just send the page to the client.  If the page is a program (perl, php, whatever), the web server runs the program, and sends the results to the client.

Depending on the language, you may not need to know the detailed syntax of the protocol - the language has a library that implements it for you.  The example I gave is in perl, and uses the LWP::Simple module.  With this module, you call the "get" function, with handles all of the protocol with the server.  If the language you choose does not have any libraries to help with this, the basic syntax is "GET page\r\n" where "page" is replaced with whatever page you want.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now