共用方式為


TcpConnectionInformation 類別

定義

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

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

範例

下列範例會顯示作用中 TCP 連線的端點資訊。

void GetTcpConnections()
{
   IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
   array<TcpConnectionInformation^>^connections = properties->GetActiveTcpConnections();
   System::Collections::IEnumerator^ myEnum = connections->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      TcpConnectionInformation ^ t = safe_cast<TcpConnectionInformation ^>(myEnum->Current);
      Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address );
      Console::Write( "Remote endpoint: {0} ", t->RemoteEndPoint->Address );
      Console::WriteLine( "{0}", t->State );
   }
}
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 中。

建構函式

TcpConnectionInformation()

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

屬性

LocalEndPoint

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

RemoteEndPoint

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

State

取得這個傳輸控制通訊協定 (TCP) 連線的狀態。

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

適用於