首页 > 编程语言 > 详细

Unity3d Detect NetState

时间:2015-01-07 16:40:28      阅读:236      评论:0      收藏:0      [点我收藏+]
 1     public static bool HasConnection()
 2     {
 3         System.Net.WebClient client;
 4         System.IO.Stream stream;
 5         try
 6         {
 7             using (client = new System.Net.WebClient())
 8 
 9             using (stream = client.OpenRead(GameUrl.BaseUrl))
10             {
11                 return client.ResponseHeaders != null && client.ResponseHeaders.Count > 0;
12             }
13 
14         }
15         catch (Exception e)
16         {
17             return false;
18         }
19     }

 

Unity3d Detect NetState

原文:http://www.cnblogs.com/chongxin/p/4208669.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!