Google Answers Logo
View Question
 
Q: Java Applet security to open external Sockets? ( No Answer,   1 Comment )
Question  
Subject: Java Applet security to open external Sockets?
Category: Computers > Programming
Asked by: evanstaul-ga
List Price: $15.00
Posted: 08 Apr 2003 21:53 PDT
Expires: 09 Apr 2003 18:43 PDT
Question ID: 188087
I have an Java 1.1 applet on the web on a server.  I want that applet
to be able to send and receive thru sockets to any computer or server
with this applet, doing things such as peer-to-peer.  I want this
program to work on any browser, Internet Explorer or Netscape.  And to
work thru the new Java plug-in or the JVM in atleast Internet
Explorer.

Is there a cheap way, without a certificate or by making it atleast
ask the user to allow the applet to allow sockets.  Please have
detailed steps on how I can accomplish this, the things I need
(certificates?), how I can get them, and how do I do it.  Remember
this must be using Java 1.1, standard on most browsers.  Thanks!
Answer  
There is no answer at this time.

Comments  
Subject: Re: Java Applet security to open external Sockets?
From: eadfrith-ga on 09 Apr 2003 10:30 PDT
 
Hi evanstaul,

Unfortunately, implementing direct peer-to-peer communication 
between applets is very troublesome. But there is another solution
that may work for you (see below).

As you may know, applets run in a sandbox within the browser. The 
sandbox limits the access of the applet to system resources, 
including sockets. By default, applets are only allowed to open 
sockets to the server from which they were originally requested. To 
implement direct peer-to-peer communication between applets you'll 
have to sign your applet and have the user grant permission to the
applet to open sockets to any host.

Here's an excellent site with step-by-step instructions on how to 
write and deploy a signed applet.

http://download.baltimore.com/keytools/docs/v51/pro/j-docs/html/SampleCodes/sampleApplet/codesign/sa/sa_step0.html

The example applet in this case requests permission to write to disk,
but in your case you'd be asking for permission to open a socket.
As you'll see from this site, the steps involved are quite onerous.

Another solution that you might consider is to implement
applet-to-applet
communiction via the server. Each applet opens a socket to a server 
application running on the machine from which it was served (which
means
that no certificates or signing are required). One applet can then
commincate
with another by sending a request to the server, which authenticates
it and
passes it on to the destination applet. The drawbacks of this approach
are
that you'll need to write and host a server application and
communication may be a little slower.

Hope this helps.

Eadfrith

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy