摘要: 判断是否可以连接服务器?privatestaticboolIsCanConnect(stringurl){HttpWebRequestreq=null;HttpWebResponseres=null;boolCanCn=true;//设成可以连接;try{req=(HttpWebRequest)WebRequest.Create(url);res=(HttpWebResponse)req.GetResponse();}catch(Exception){CanCn=false;//无法连接}finally{if(res!=null){res.Close();}}returnCanCn;} 阅读全文
posted @ 2012-02-22 17:40 PPDev 阅读(5404) 评论(0) 推荐(0) 编辑