中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

C#檢測遠程計算機端口是否打開

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

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

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()
        {
            //code from http://www.sharejs.com/codes
 
            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();
        }
 
 
    }
}
 
  
 
{--運行結果:--
 
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

標簽: 代碼

版權申明:本站文章部分自網絡,如有侵權,請聯系:west999com@outlook.com
特別注意:本站所有轉載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯系。

上一篇:C#調用mmpeg進行各種視頻轉換的封裝類代碼

下一篇:自定義C#類產生不重復的隨機字符串