欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)TCP連接信息統(tǒng)計(jì)的方法

 更新時(shí)間:2015年07月03日 10:06:48   作者:程序猴  
這篇文章主要介紹了C#實(shí)現(xiàn)TCP連接信息統(tǒng)計(jì)的方法,可實(shí)現(xiàn)有效獲取TCP連接信息及連接狀態(tài)的功能,需要的朋友可以參考下

本文實(shí)例講述了C#實(shí)現(xiàn)TCP連接信息統(tǒng)計(jì)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.NetworkInformation;
namespace test2
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {
      IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
      TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();
      foreach (TcpConnectionInformation t in connections)
      {
        listBoxResult.Items.Add("本地端點(diǎn): " + t.LocalEndPoint.Address);
        listBoxResult.Items.Add("遠(yuǎn)程端點(diǎn): " + t.RemoteEndPoint.Address);
        listBoxResult.Items.Add("狀態(tài):" + t.State);
      }
    }
  }
}

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

相關(guān)文章

最新評(píng)論