Solved

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

Posted on 2010-09-22
5
489 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 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