看板java
标 题Re: [问题]请问applet 开socket 连Java 写的server程式
发信站淡江资工地上站 (Fri Jul 28 07:00:44 2006)
转信站ptt!ctu-reader!news.nctu!TKUCSBBS
※ 引述《[email protected] (小龙)》之铭言:
> 如题 我开一个IE内崁Applet的程式
> Applet是Client端开socket 连Server端的程式
> 可是Clinet端好像开不出Socket 应该是权限的问题
> throw出以下的情况...
> access denied (java.net.SocketPermission 140.xxx.xxx.xxx:9999 connect,resolve)
> 这样的情况
> 烦请大家回答...
http://java.sun.com/sfaq/#socket
8. How can an applet open a network connection to a computer on the internet?
Applets are not allowed to open network connections to any computer, except
for the host that provided the .class files. This is either the host where
the html page came from, or the host specified in the codebase parameter in
the applet tag, with codebase taking precendence.
For example, if you try to do this from an applet that did not originate from
the machine foo.com, it will fail with a security exception:
Socket s = new Socket("foo.com", 25, true);
--
◤ ▁▁──────────────────────╮
淡江资工地上站 ▁▁ Author: flame ●│
◣ bbs.cs.tku.edu.tw From: 210-58-48-57.cm.dynamic.apol.com.tw│