码迷,mamicode.com
首页 > 编程语言 > 详细

Unity3d Detect NetState

时间:2015-01-07 16:43:29      阅读:183      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!