在我的页面中有AppletTest.class代码里面有这几个主要的方法:pub...
在我的页面中有
AppletTest.class代码里面有这几个主要的方法:
public void paint(Graphics g){
str=connectionTest("15.50.10.181",3389);
System.out.println("message:"+str);
g.drawString(str, 2, 60);
}
public String connectionTest(String ip, Integer port){
final Integer TIMEOUT = 4000;// ms
String message="";
InetAddress theAddress;
try {
theAddress = InetAddress.getByName(ip);
InetSocketAddress inetSocketAddress = new InetSocketAddress(theAddress, port);
Socket socket = new Socket();
socket.connect(inetSocketAddress, TIMEOUT);
message ="success!";
} catch (UnknownHostException e) {
message="connection timeout1!";
e.printStackTrace();
} catch (IOException e) {
message="connection timeout2!";
System.out.println("connection timeout!");
e.printStackTrace();
}
System.out.println("here is a testReturnAndReadfunction:---"+message);
return message;
}
public String commonTest(String s){
return "test"+s;
}
然后appletTest.jar已经进行self数字签名了,Applet中gaint()方法会自动调用返回结果success, 然后我在JS中用
var message2 =window.document.app.commonTest("JSTest");调用也能返回结果,但是当我用
var message=window.document.app.connectionTest("15.50.10.181",3389);浏览器就会卡死无法执行,
我的问题是为什么connectionTest()方法在类里面调用能执行,但是在JS中调用却执行不了,而其它的方法却能正常执行,在connectionTest()方法里面使用了Socket等功能,用来连接另一台服务器,请问是安全受限问题吗,开始在类里面都执行失败的,后来我用了数字证书之后,在代码能正常执行了,现在的问题是需要申请一个企业级的Publish的证书才能执行吗?
展开