TcpConnectionInformation クラス
アセンブリ: System (system.dll 内)
構文
解説
使用例
アクティブな TCP 接続のエンドポイント情報を表示するコード例を次に示します。
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 '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.Address); Console.Write("Remote endpoint: {0} ",t.RemoteEndPoint.Address); Console.WriteLine("{0}",t.State); } }
System.Net.NetworkInformation.TcpConnectionInformation
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- TcpConnectionInformation クラスのページへのリンク