TcpListener.LocalEndpoint プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TcpListener.LocalEndpoint プロパティの意味・解説 

TcpListener.LocalEndpoint プロパティ

現在の TcpListener の基になる EndPoint取得します

名前空間: System.Net.Sockets
アセンブリ: System (system.dll 内)
構文構文

Dim instance As TcpListener
Dim value As EndPoint

value = instance.LocalEndpoint
public EndPoint LocalEndpoint { get; }
public:
property EndPoint^ LocalEndpoint {
    EndPoint^ get ();
}
/** @property */
public EndPoint get_LocalEndpoint ()

プロパティ
Socketバインドする対象EndPoint

解説解説
使用例使用例

TcpListener受信接続要求待機している対象ローカル IP アドレスポート番号表示するコード例次に示します

Try

     Dim ipAddress As IPAddress = Dns.Resolve("localhost").AddressList(0)
  Dim tcpListener As New
 TcpListener(ipAddress, portNumber)
  tcpListener.Start()
  
   ' Use the Pending method to poll the underlying socket instance for
 client connection requests.
   If Not tcpListener.Pending() Then
      
      Console.WriteLine("Sorry, no connection requests have arrived")
   
   Else
      
      'Accept the pending client connection and return a TcpClient object
 initialized for communication.
      Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient()
      ' Using the RemoteEndPoint property.
      Console.Write("I am listening for connections on ")
      Console.Writeline(IPAddress.Parse(CType(tcpListener.LocalEndpoint, IPEndPoint).Address.ToString()))
 
      Console.Write("on port number ")
      Console.Write(CType(tcpListener.LocalEndpoint, IPEndPoint).Port.ToString())
      
        
try{
        // Use the Pending method to poll the underlying socket instance
 for client connection requests.
            IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
         TcpListener tcpListener =  new TcpListener(ipAddress,
 portNumber); 
         tcpListener.Start();
         
          if (!tcpListener.Pending()) {

          Console.WriteLine("Sorry, no connection requests have arrived");
          
       }
       else{

             //Accept the pending client connection and return a TcpClient
 object initialized for communication.
             TcpClient tcpClient = tcpListener.AcceptTcpClient();
             // Using the RemoteEndPoint property.
             Console.WriteLine("I am listening for connections
 on " + 
                                         IPAddress.Parse(((IPEndPoint)tcpListener.LocalEndpoint).Address.ToString())
 +
                                            "on port number " + ((IPEndPoint)tcpListener.LocalEndpoint).Port.ToString());

try
{
   // Use the Pending method to poll the underlying socket instance
 for client connection requests.
   TcpListener^ tcpListener = gcnew TcpListener( portNumber );
   tcpListener->Start();

   if ( !tcpListener->Pending() )
   {
      Console::WriteLine( "Sorry, no connection requests have arrived"
 );
   }
   else
   {
      //Accept the pending client connection and return a TcpClient
 object^ initialized for communication.
      TcpClient^ tcpClient = tcpListener->AcceptTcpClient();
      
      // Using the RemoteEndPoint property.
      Console::WriteLine( "I am listening for connections
 on {0} on port number {1}",
         IPAddress::Parse( ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Address->ToString()
 ),
         ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Port );
try {
    // Use the Pending method to poll the underlying socket instance
    // for client connection requests.
    IPAddress ipAddress = Dns.Resolve("localhost").get_AddressList()[0];
    TcpListener tcpListener = new TcpListener(ipAddress, portNumber);
    tcpListener.Start();

    if (!(tcpListener.Pending())) {
        Console.WriteLine("Sorry, no connection requests have arrived");
    }
    else {
        //Accept the pending client connection and return a TcpClient
        //object initialized for communication.
        TcpClient tcpClient = tcpListener.AcceptTcpClient();
        // Using the RemoteEndPoint property.
        Console.WriteLine("I am listening for connections
 on "
            + IPAddress.Parse(((IPEndPoint)
            (tcpListener.get_LocalEndpoint())).get_Address().ToString())
            + "on port number " + ((Int32)((IPEndPoint)
            (tcpListener.get_LocalEndpoint())).get_Port()).ToString());
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TcpListener クラス
TcpListener メンバ
System.Net.Sockets 名前空間
Listen
EndPoint クラス


このページでは「.NET Framework クラス ライブラリ リファレンス」からTcpListener.LocalEndpoint プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTcpListener.LocalEndpoint プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTcpListener.LocalEndpoint プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

TcpListener.LocalEndpoint プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TcpListener.LocalEndpoint プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS