Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Applets Communication
Posted by Justin Shuxteau on June 11, 2001 at 10:49 AM
> Is it possible to, and if so, how would I connect two applets through the use of sockets? Is there another way to connect them? No need to be too specific (unless you want to be), just set me on the right road. > Thanks, > KP. JS wrote: You will not be able to create a ServerSocket in an applet. It is considered a security breach as a malicious applet might spoof some application and obtain sensitive information. Another way you can communicate is through appletContext class. AppletContext class in the java.applet package contains the two member functions getApplet and getApplets. The only requirement for this to work is that these two applets have to be on the same html page. If they are on different HTML pages but still have the same codebase, therefore, use the same runtime, you can also use a static data member which refer to itself inside the applet and the other one can call the reference after the first one is initialized. Good luck, JS
Replies:
|