Getting Two Java Applets to Communicate with Each Other

K

kvnsmnsn

Is there a way in Java to write two applets in which one user using
one applet can send messages to be read by another user using the
other applet, at a potentially distant location?

---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
 
R

Roedy Green

Is there a way in Java to write two applets in which one user using
one applet can send messages to be read by another user using the
other applet, at a potentially distant location?

Yes. Once you have the AppletContext you can call methods of the
other applets.

See http://mindprod.com/products1.html#CURRCON source code for an
example of how I do it. In CurrCon, if any Applets discovers the user
would like to use a different currency, it informs all the other
Applets who update their displays.
 
A

Andrew Thompson

Yes. Once you have the AppletContext

...I do not understand how the AppletContext can be used here.
The context is not guaranteed to be the same in different frames
of a web page, let alone for another applet at 'a potentially
distant location'.

To the OP, could you tell us. Do you mean communicate between
applets on different PC's?

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"If no one out there understands, start your own revolution and cut out the
middle man."
Billy Bragg 'Waiting For The Great Leap Forward'
 
R

Roedy Green

..I do not understand how the AppletContext can be used here.
The context is not guaranteed to be the same in different frames
of a web page, let alone for another applet at 'a potentially
distant location'.

Sorry, the communication I described is between Applets at potentially
distant locations on the same page. There are other techniques for
Applet communication on different pages. See
http://mindprod.com/jgloss/persistence.html

If the Applets are running in different machines, they will have to
set up sockets or send datagrams to each other, or communicate via a
server. For direct Applet to Applet communication you will need to
sign the Applets.

There are many possibilities for communication:

see http://mindprod.com/jgloss/remotefileaccess.html
 
J

Joan

Andrew Thompson said:
..I do not understand how the AppletContext can be used here.
The context is not guaranteed to be the same in different
frames
of a web page, let alone for another applet at 'a potentially
distant location'.

I want to communicate with the applet in my left shoe that
monitors
all motion and activates the blinking lights.
 
A

Andrew Thompson

Sorry, the communication I described is between Applets at potentially
distant locations on the same page. There are other techniques for
Applet communication on different pages. ..

Yep. That's what I think the OP meant (I also thought
you'd have a couple of suitable pages, but did not have
time to check)..

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"The storm broke with a violent flash of lightning, and an apalling crash
of thunder.."
Severed Heads 'Dead Eyes Opened'
 
R

Roedy Green

I want to communicate with the applet in my left shoe that
monitors
all motion and activates the blinking lights.

Depending on where the blinking lights are, one of the three answers
should help you.
 
J

John Currier

Is there a way in Java to write two applets in which one user using
one applet can send messages to be read by another user using the
other applet, at a potentially distant location?

---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

The only approach that I've tried that worked reliably on the various
browsers was to talk though sockets.

John
http://schemaspy.sourceforge.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top