Click to See Complete Forum and Search --> : Security exception


Arthur
July 25th, 1999, 12:30 PM
Hi,
I am just new in the world of Java programming and I have the following problem.
I programmed an application that performs network IO using sockets. This works fine in a console,
but if I use this network class in an applet, it won't run.
The browser gives a message about network security exceptions.
How can I get access to the network out of an applet?

Thanx in advance,
Arthur

July 25th, 1999, 11:15 PM
Java applets have security restrictions and u have encountered a security restriction from the JVM . Applets cannot open network connecions to other machines and can ONLY connect to the machine from where it has been downloaded.So internally the JVM checks if such a connection is legal by invoking some methods of security manager( i dont want go to the details) and it throws the exception. If u still want to override the security restrictions - use signed applets(more info visit java.sun.com/security) OR
in case ur using netscape use netscape capabilities api(developers.netscape.com)

July 26th, 1999, 03:04 PM
An applet can make socket connections
ONLY
to the machine from which the html was downloaded from.
Your browser has a security manager which will restrict the applet from making socket connections to host other than the one from which it originated.