Getting Two Java Applets to Communicate with Each Other

Discussion in 'Java' started by kvnsmnsn@hotmail.com, Aug 30, 2005.

  1. Guest

    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_
    , Aug 30, 2005
    #1
    1. Advertising

  2. Roedy Green Guest

    On 30 Aug 2005 14:38:54 -0700, wrote or quoted :

    >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.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Aug 31, 2005
    #2
    1. Advertising

  3. On Wed, 31 Aug 2005 00:45:35 GMT, Roedy Green wrote:

    > On 30 Aug 2005 14:38:54 -0700, wrote or quoted :
    >
    >>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


    ...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'
    Andrew Thompson, Aug 31, 2005
    #3
  4. Roedy Green Guest

    On Wed, 31 Aug 2005 01:50:25 GMT, Andrew Thompson
    <> wrote or quoted :

    >..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
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Aug 31, 2005
    #4
  5. Joan Guest

    "Andrew Thompson" <> wrote in message
    news:...
    > On Wed, 31 Aug 2005 00:45:35 GMT, Roedy Green wrote:
    >
    >> On 30 Aug 2005 14:38:54 -0700, wrote or
    >> quoted :
    >>
    >>>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

    >
    > ..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.
    Joan, Aug 31, 2005
    #5
  6. On Wed, 31 Aug 2005 03:24:49 GMT, Roedy Green wrote:

    > 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'
    Andrew Thompson, Aug 31, 2005
    #6
  7. Roedy Green Guest

    On Tue, 30 Aug 2005 23:22:53 -0500, "Joan" <> wrote
    or quoted :

    >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.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Aug 31, 2005
    #7
  8. John Currier Guest

    wrote:
    > 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
    John Currier, Sep 4, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wolf
    Replies:
    1
    Views:
    1,042
    Carl Prothman [MVP]
    Aug 9, 2003
  2. Rune Andresen
    Replies:
    2
    Views:
    358
    Rune Andresen
    Aug 24, 2003
  3. anne001
    Replies:
    21
    Views:
    293
  4. Pat Maddox
    Replies:
    6
    Views:
    142
    Marcin Mielżyński
    Jan 20, 2006
  5. bscofield
    Replies:
    1
    Views:
    147
    Dr John Stockton
    Feb 9, 2004
Loading...

Share This Page