public void actionPerformed(ActionEvent e) {
System.getProperties().put("proxySet","true");
System.getProperties().put( "http.proxyHost", "10.10.2.209" );
System.getProperties().put( "http.proxyPort", "899" );
StringBuffer page = new StringBuffer();
try {
String s="http://feeds.china.msn.com/weather/";
URL site = new URL(s);
URLConnection agent = site.openConnection();
InputStream is = agent.getInputStream();
BufferedReader input = new BufferedReader(new InputStreamReader(is));
int ch;
while ( (ch = input.read()) != -1) {
page.append( (char) ch);
System.out.println(page);
}
input.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
程序一执行,通过system.out.println()打印出的是"用户数不够",但是,可以确定,就我一个用户使用这个代理.请问是什么原因导致的.
System.getProperties().put("proxySet","true");
System.getProperties().put( "http.proxyHost", "10.10.2.209" );
System.getProperties().put( "http.proxyPort", "899" );
StringBuffer page = new StringBuffer();
try {
String s="http://feeds.china.msn.com/weather/";
URL site = new URL(s);
URLConnection agent = site.openConnection();
InputStream is = agent.getInputStream();
BufferedReader input = new BufferedReader(new InputStreamReader(is));
int ch;
while ( (ch = input.read()) != -1) {
page.append( (char) ch);
System.out.println(page);
}
input.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
程序一执行,通过system.out.println()打印出的是"用户数不够",但是,可以确定,就我一个用户使用这个代理.请问是什么原因导致的.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货