最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#檢測(cè)遠(yuǎn)程計(jì)算機(jī)端口是否打開的方法

 更新時(shí)間:2015年03月23日 09:54:33   作者:chongq  
這篇文章主要介紹了C#檢測(cè)遠(yuǎn)程計(jì)算機(jī)端口是否打開的方法,實(shí)例分析了C#實(shí)現(xiàn)檢測(cè)遠(yuǎn)程端口開啟的技巧,需要的朋友可以參考下

本文實(shí)例講述了C#檢測(cè)遠(yuǎn)程計(jì)算機(jī)端口是否打開的方法。分享給大家供大家參考。具體分析如下:

這段C#代碼用于檢測(cè)遠(yuǎn)程計(jì)算機(jī)的3389端口是否處理打開狀態(tài),可以根據(jù)實(shí)際需要設(shè)置其它端口

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.NetworkInformation;
namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
      GetTcpConnections();
    }
    public static void GetTcpConnections()
    {
      IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
      TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();
      foreach (TcpConnectionInformation t in connections)
      {
        Console.Write("Local endpoint: {0} ", t.LocalEndPoint.ToString());
        Console.Write("Remote endpoint: {0} ", t.RemoteEndPoint.ToString());
        Console.WriteLine("{0}", t.State);
      }
      Console.WriteLine();
      Console.ReadLine();
    }
  }
}

運(yùn)行結(jié)果如下:

Local endpoint: 127.0.0.1:1025 Remote endpoint: 127.0.0.1:1026 Established
Local endpoint: 127.0.0.1:1026 Remote endpoint: 127.0.0.1:1025 Established
Local endpoint: 127.0.0.1:1028 Remote endpoint: 127.0.0.1:16992 CloseWait
Local endpoint: 127.0.0.1:1110 Remote endpoint: 127.0.0.1:4900 Established
Local endpoint: 127.0.0.1:2754 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:2762 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:2773 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:2913 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:3014 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:3531 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:4012 Remote endpoint: 127.0.0.1:1110 CloseWait
Local endpoint: 127.0.0.1:4900 Remote endpoint: 127.0.0.1:1110 Established

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

江永县| 墨竹工卡县| 凤冈县| 麻城市| 通江县| 交口县| 普安县| 商河县| 拉孜县| 犍为县| 桐梓县| 新竹县| 古丈县| 赫章县| 革吉县| 民丰县| 平乐县| 大埔县| 长白| 阿克陶县| 溆浦县| 潮州市| 河南省| 桦南县| 台北县| 新平| 礼泉县| 武冈市| 沅陵县| 庄河市| 武川县| 阆中市| 庆安县| 台安县| 祁东县| 车险| 绥宁县| 皋兰县| 宣汉县| 西乡县| 开封市|