62,614
社区成员
发帖
与我相关
我的任务
分享
public class ConnectServer {
public boolean isAppInit() {
boolean appInit=true;
URL myURL;
try {
myURL = new URL("http://www.sifg.com.cn/index.jsp");
InputStream is = myURL.openStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
if((in.readLine()) == null) {
appInit=false;
return false;
}
in.close();
} catch (MalformedURLException e) {
System.out.println("服务器连接没有启动");
return false;
}catch(IOException e1){
System.out.println("读取服务器URL出现错误");
return false;
}
return appInit;
}
}