各位大神,现在都12点了,小弟这个问题无法解决了,我的java代码,
URL realUrl = new URL(“http://119.6.7.240/admin/command/control.do”);
URLConnection conn = realUrl.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
try (OutputStream out = conn.getOutputStream();){
OutputStream buffer = new BufferedOutputStream(out);
OutputStreamWriter writer = new OutputStreamWriter(buffer, "utf8");) {
writer.write(bodyStr);
writer.flush();
writer.close();
}
以上这段代码,在我本地完美运行,可是一放到云服务器上,conn.getOutputStream()这句代码就报错,报Connection timed out错误,这是为什么呢,我没有改变任何代码,放到服务器上就报错,这是为啥啊??跪求JAVA大神啊