語言

TcpConnectionInformation 類別

定義

提供本地電腦傳輸控制協定(TCP)連線的資訊。

public ref class TcpConnectionInformation abstract
public abstract class TcpConnectionInformation
type TcpConnectionInformation = class
Public MustInherit Class TcpConnectionInformation
繼承
TcpConnectionInformation

範例

以下範例顯示了活躍 TCP 連線的端點資訊。

public static void GetTcpConnections()
{
    IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
    TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();

    foreach (TcpConnectionInformation t in connections)
    {
        Console.Write("Local endpoint: {0} ",t.LocalEndPoint.Address);
        Console.Write("Remote endpoint: {0} ",t.RemoteEndPoint.Address);
        Console.WriteLine("{0}",t.State);
    }
    Console.WriteLine();
}
Public Shared Sub GetTcpConnections() 
    Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
    Dim connections As TcpConnectionInformation() = properties.GetActiveTcpConnections()
    
    Dim t As TcpConnectionInformation
    For Each t In  connections
        Console.Write("Local endpoint: {0} ", t.LocalEndPoint.Address)
        Console.Write("Remote endpoint: {0} ", t.RemoteEndPoint.Address)
        Console.WriteLine("{0}", t.State)
    Next t

End Sub

備註

TCP 是一種連線導向且可靠的協定,用於在網路電腦間傳輸資料。 它在 IETF RFC 793 中被定義。

建構函式

名稱 Description
TcpConnectionInformation()

初始化 TcpConnectionInformation 類別的新執行個體。

屬性

名稱 Description
LocalEndPoint

取得傳輸控制協定(TCP)連線的本地端點。

RemoteEndPoint

取得傳輸控制協定(TCP)連線的遠端端點。

State

取得此傳輸控制協定(TCP)連線的狀態。

方法

名稱 Description
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於