简体   繁体   中英

Retrieve data from IP address/port using browser applet

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

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM