C#判断网络连接问题 我这里有个连接【宽带连接】,怎样可以判断这个连接是否已经连接,哪位高手帮忙解决下(详细代码)if(???){ ...}else{ ...}帮帮忙,谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private Socket TSocketif(TSocket !=null) private void button1_Click(object sender, EventArgs e) { System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; string strOutput = null; try { p.Start(); p.StandardInput.WriteLine("rasdial"); p.StandardInput.WriteLine("exit"); strOutput = p.StandardOutput.ReadToEnd(); p.WaitForExit(); } catch (Exception ex) { strOutput = ex.Message; System.Threading.Thread.Sleep(1000); } finally { if (p != null) p.Close(); } if (strOutput.IndexOf("已连接") >= 0) { MessageBox.Show("已连接"); } else { MessageBox.Show("未连接"); } } 可以参考:http://blog.csdn.net/huangyaoshifog/archive/2009/08/24/4474834.aspx 求助 各位大侠帮帮忙啊 页面启动的问题? 提一个很SB的问题 如下的属性加到窗体为什么不在属性栏显示呢???? 请给几种思路:在类A中的方法B中需要更新另外一个Form中ListBox的内容 请问开发出来的类库即DLL,再在其他程序引用的话。(请看里面) C#调用C++的dll出现CrossThreadMessagingException异常 asp.net 加载短信mas接口失败! 关于两个窗体之间的问题,很麻烦,帮个忙 模拟新浪微博登录 返回错误4402 不知道是什么问题 这样的Timer该如何实现? 对VS2005熟悉的兄弟们望着看呀!
if(TSocket !=null)
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string strOutput = null; try
{
p.Start();
p.StandardInput.WriteLine("rasdial");
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit(); }
catch (Exception ex)
{
strOutput = ex.Message;
System.Threading.Thread.Sleep(1000);
}
finally
{
if (p != null)
p.Close();
}
if (strOutput.IndexOf("已连接") >= 0)
{
MessageBox.Show("已连接");
}
else
{
MessageBox.Show("未连接");
}
}
http://blog.csdn.net/huangyaoshifog/archive/2009/08/24/4474834.aspx