Results 1 to 4 of 4
  1. #1
    jsman is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Java Applet to Applet communication

    Hi,

    I have been searching resources for a while now and have not found a solution to my question.

    I am looking to implement a program which would allow two Java Applets to communicate with one another without the need for a Server, effectively a Peer to Peer solution, using Sockets.

    The problem is, I have not found a definitive resource which says and demonstrates that this is possible. I have found information which allows Applets to talk to one another on the same page but I am talking about Applets talking to one another through the browser from different computers, though loading the applet from the same web server, through the same webpage.

    Any help would be appreciated.

    EDIT: I can have available to me a list of peers to connect to (their IP and Port) which could make things easier, so the clients can be discovered.

    Thank you,
    Last edited by jsman; 04-01-2011 at 06:19 PM. Reason: Extra info

  2. #2
    JavaRulez is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    An untrusted applet cannot do what you are trying to accomplish. From within the sandbox an applet can only perform network communication with the originating server of the applets code.

    I have never tried this, but a quick google search gives an indication to me that if you sign your applet (it must be packaged in a jar file) certain browsers may relieve the restrictions of the sandbox.

  3. #3
    jsman is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default

    Yeah, that is true. I have manage to answer my own question.

    I created a self-signed applet and set it in a Client/Server scenario. Signing the applet allowed me to jump outside of the sandbox making Applet to Applet communication possible. I don't know why there isn't more information out there specifically on p2p applet communication.

  4. #4
    JavaRulez is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    I think the issue is that this behavior may be implementation specific, a perceivable configuration of browser and plugin may still restrict your applet even now that it is signed. With that in mind, it makes sense why this is undocumented, because it is not (necessarily) reliable. What you are doing is more suited to an Application than to an embeded Applet.

Similar Threads

  1. applet class inside java.applet.* or java.awt.*
    By Manish87 in forum Java Applets
    Replies: 1
    Last Post: 09-27-2010, 02:15 PM
  2. Replies: 2
    Last Post: 09-29-2009, 03:33 PM
  3. applet servlet communication
    By viswamadhavi in forum Java Applets
    Replies: 0
    Last Post: 04-06-2009, 01:12 PM
  4. applet servlet communication
    By hardc0d3r in forum Java Applets
    Replies: 1
    Last Post: 07-12-2007, 06:58 PM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •