开发者

socket permission in java

开发者 https://www.devze.com 2023-02-01 07:50 出处:网络
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 an

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消