0

My goal is to send data from a PC to a Viewing Station (running Linux, on the same network) so that the user at the Viewing Station (VS) can view a graph of the data. I am not allowed to install any applications on the Viewing Station but it does have a browser (something like Firefox or Chrome).

The only way I could think of doing this is to create a java applet which is opened in the browser (on the viewing station), which reads data from the IP address/ port on the viewing station.

Is this possible? How can I go about doing this? Thanks

edit: I cannot send the data to be graphed, outside of the local network. The data is sent from the PC to a local IP address where the viewing station is located. Scenario:

  1. PC starts sending data to be graphed, to a fixed IP address (where the viewing station is located).
  2. User opens up a browser in the viewing station and opens something that shows the graph. The graph should contain the data received from a predefined port/IP address.
  3. New values are added every 240ms.

edit2: We have shelved this feature for now so I am unable to try any of the mentioned solutions. Thanks for the input though

Praveen
  • 63
  • 1
  • 8
  • Is there something preventing you from running a webserver on the 'sending' side and presenting the graph with javascript etc? – Thomas Feb 21 '12 at 21:46
  • Thank you for the reply, Thomas. I shouldn't be sending data outside the local network. The data is sent from the PC to a local IP address (at which the viewing station is located) where it is to be displayed as a graph. – Praveen Feb 22 '12 at 14:32

3 Answers3

1

Use JCharts. It allows you to make graphs and charts and display them via servlet, applet, or standalone UI. Code it up into some servlets on your server side and then you can view them on the client browsers.

Perception
  • 79,279
  • 19
  • 185
  • 195
1

If a server-side solution is not practical, I'd look to implement simple graphs using JS and the HTML 5 canvas. For more complex graphs, find a JS API.

If a server-side solution is practical, use JFreeChart (or JCharts etc.) to produce an image on the server-side, then provide that image to the client.

Although browsers may be installed on the client, it does not necessarily mean that Java is installed & enabled in those browsers.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • The browser on the client is already ran a few other java applets so I assume it has Java installed and enabled. I was thinking of a scenario where the user opens a web link that has the applet and the applet reads data from a local IP address/port to graph data. – Praveen Feb 22 '12 at 14:49
  • 1
    I'm not sure. It sounds like something that would require a trusted applet, but if the 'not allowed to install any applications' is any indication, the Java will be blocked from allowing all but fully trusted digit certificates (read 'expensive'). As an aside, although it is not obvious to the user or newbie developer, even a sand-boxed applet is downloaded to a place on the local file-system before being launched. Or in other words, it is installed. Where is the web page that loads the applet? If it is read off filesystem on the VS, then that is another file that needs to be 'installed'. – Andrew Thompson Feb 22 '12 at 15:32
  • I was thinking I'll create a webpage containing the applet (and maybe put it on the company website) which the user can open from the VS. Also, can I just not prompt the user to ask for permission to run the applet with full access, without actually having a trusted certificate? The user already knows that mine is a trusted applet. Thank you for your patience – Praveen Feb 22 '12 at 15:39
  • Can they surf the net from that PC? If so, a quick answer to your question can be found by visiting my [self signed applet](http://pscode.org/prop/?prop=java.version%2Cuser.name&format=TSV). It will query the JRE for `java.version` & `user.name` and display them in the table. The first is available to any applet, but the second will show as `unknown` for any applet that is not trusted. – Andrew Thompson Feb 22 '12 at 15:46
  • Name Value java.version 1.6.0_29 user.name unknown.... That's what showed up on my computer. I understand that the applet doesn't have access to the user name. When I click the 'Copy to Clipboard', the applet asks for permission to write to the clipboard. Can I do a similar request and ask for permission to read from a port? – Praveen Feb 22 '12 at 16:00
1

The main problem with your plan is that you cannot 'push' data to your viewer unless there is a service there to accept it. If you cannot install such a service, your options are limited.

1: Map a network drive. The 'producer' dumps the data here, and the 'viewer' can read it. It is unlikely given your restrictions that you will be allowed to do this.

2: Use any of the graph libraries suggested by others and configure your webserver to restrict access to a whitelist of hosts. Your 'producer' runs a webserver which will only serve pages to a specific IP or subnet, your 'consumer' connects to said webserver. See here or here for setting up a webserver which only allows access from a specific IP.

Community
  • 1
  • 1
Thomas
  • 5,074
  • 1
  • 16
  • 12