Previous in Forum: Bar Graph Indicator   Next in Forum: Simulation for Control Valves
Close
Close
Close
6 comments
Rate Comments: Nested
Member

Join Date: Mar 2007
Posts: 6

Code for refreshing another comptuer's display, based on data entry

03/03/2007 11:59 PM

Does anyone know how to - or know of an example of source code - where when a person working on computer "A", does a certain command, that calls a process where Computer "B" is notified that data has changed, and therefore refreshes itself and gets the changed data?

This is being looked at on an information display type of application, so the user at computer "B" never has to do anything or even press a button on his computer, ever, he is always supplied with the current data from computer "A". I'm programming in Java Eclipse.

I'm going to try to hash this one out, but I could use some help.

Thanks.

- Bret

Register to Reply
Pathfinder Tags: Java programming networking
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Active Contributor
Engineering Fields - Electromechanical Engineering - New Member

Join Date: Jan 2007
Posts: 13
#1

Re: Code for refreshing another comptuer's display, based on data entry

03/04/2007 6:14 PM

There's a lot of methods to do this. It depends on how complicated the data is, the OS's involved, and where the 2 computers are located relative to each other, and how much control you have over the application on computer "A". The easiest setup is if they are on the same network subnet, if you are talking over the internet you have to deal with firewalls, routers, etc.

Either way, probably the first thing that comes to mind, assuming it's relatively limited data such as the state of something, is to simply send udp datagrams through standard TCP/IP communication. Set up a listener on computer "B" and have the application (server) on computer "A" send the datagrams at the appropriate times. If they are both on an internal LAN, you can even use UDP Broadcast or UDP Multicast so the server doesn't have to know the IP address of the listener(s).

I'm not familiar with Java, but I think it has class libraries for this. I use MS VB.Net, C#, and National Instruments Labview which have the functionality fairly built-in.

HTH,
Mike

Register to Reply
The Architect
Engineering Fields - Software Engineering - S/W Architect Popular Science - Evolution - Fascinating! Fans of Old Computers - TRS-80 - A fine computer United States - US - Statue of Liberty - NY

Join Date: Dec 2004
Location: GlobalSpec, Troy NY
Posts: 386
Good Answers: 5
#2

Re: Code for refreshing another comptuer's display, based on data entry

03/05/2007 9:57 AM

You are describing a typical network application arrangement... probably "client/server" best describes it. The "client" is the data display machine, and you should consider that there can be 0, 1, or more of them. (This is "computer B" in your example.) The "server" is the one that is the "master", there is usually only one computer playing this role. (This is "computer A" in your example.)

If you control the software on both computers then you have lots of choices. One crude-but-effective option is to have the client "poll" the server for the latest data at fixed time intervals. You can even use a web server ptorocol (HTTP) to connect the client to the server.

There are too many options to describe the all, and they have different strengths and weaknesses. Can you describe the data that could change a little? Is there tons of data being generated on the server (like from data logger, or some other data collection system), or are you talking about a small, fixed number of data points? How frequently does the data change?

Thanks

Mark

__________________
Mark Gaulin
Register to Reply
Member

Join Date: Mar 2007
Posts: 6
#3
In reply to #2

Re: Code for refreshing another comptuer's display, based on data entry

03/05/2007 5:01 PM

Thanks guys.

I've progressed on this since my first post. The basic layout of my scenario is I have two computers, there will be more, hooked up on a LAN. I've got my program that loads a status board, showing the status of a lot of different things. These statuses update periodically, say, ten will update every few minutes. There are about 200 total data on this display that are regulated by data from the server.

The tricky part to this is that this display is actually a Flex element, with Flash player elements embedded into it, all embedded into a Java Eclipse SWT GUI. If it weren't a flash/flex player movie that was displaying this data, it would be no problem.

Where we actually hang up is in looking to the server to see if the file has changed, then when it has, running the update procedure, and then restarting the looking to the server again without "tripping over" the loading of the flash player that is only still in progress. It takes a few seconds for the flash player to load, and if we interrupt that loading process with a ".wait()", the thing hangs - it waits.

So then we got into threading - that was a bit too deep.

So now we're exploring the possibilities of making our loading method, that actually loads the flash player, fire an event at the end of that method, only when it has fully completed the load. That will then tell our function that looks to the server for any changes to restart looking.

That's the deal. If anyone has any input, feel free.

- Bret

Register to Reply
Active Contributor
Engineering Fields - Electromechanical Engineering - New Member

Join Date: Jan 2007
Posts: 13
#4
In reply to #3

Re: Code for refreshing another comptuer's display, based on data entry

03/05/2007 5:09 PM

You may have better luck posting your question on a Flash or Java newsgroup on usenet...

Mike

Register to Reply
The Architect
Engineering Fields - Software Engineering - S/W Architect Popular Science - Evolution - Fascinating! Fans of Old Computers - TRS-80 - A fine computer United States - US - Statue of Liberty - NY

Join Date: Dec 2004
Location: GlobalSpec, Troy NY
Posts: 386
Good Answers: 5
#5
In reply to #4

Re: Code for refreshing another comptuer's display, based on data entry

03/06/2007 8:42 AM

This is good advice. Once your technologies are picked the best source for solutions to weird little things is often from a mailing list or user group. See if any here look good.

__________________
Mark Gaulin
Register to Reply
Member

Join Date: Mar 2007
Posts: 6
#6
In reply to #5

Re: Code for refreshing another comptuer's display, based on data entry

03/06/2007 2:25 PM

Thanks for the tips.

We did get with some pros in this area and we actually resolved it!

The solution was in threading the logic on one thread, with the GUI on another thread, and having the logic thread call, only when it was ready, the GUI thread to load the flash movie into the Java app. We used the AsynchManager class and threading. It took us two days flat out, but we got it.

- Bret

Register to Reply
Register to Reply 6 comments
Copy to Clipboard

Users who posted comments:

BretB (2); mgaulin (2); mjvonstein (2)

Previous in Forum: Bar Graph Indicator   Next in Forum: Simulation for Control Valves
You might be interested in: Bar Code Scanners, Bar Code Cards, Bar Code Software

Advertisement