socket permission in java
Through java applet I am trying to get socket connection from a client to the server. I encountered "Access denied - SocketPermission". Please let me know the changes I need to make in the Applet and in the server program.
开发者_JAVA技巧Thanks, John
Applets can connect only to server they were downloaded from. This restriction exists for security reasons.
So, if for example your applet's code
attribute is http://mycompany.com/myapplet
you have to connect to mycompany.com from your applet. Otherwise you will get security exception.
If your really need to connect to other place you have to sign your applet.
Difficult to say without seeing the code or the exact error, but I'd start by making sure you understand the applet security model Java uses. I would start here: What Applets Can and Cannot Do
It might be that you need to sign the applet, or otherwise adjust the security policy of the client system.
精彩评论