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

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

HttpWebRequest.ServicePoint プロパティ

要求に対して使用するサービス ポイント取得します

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

解説解説

要求リダイレクトされる場合、ServicePoint.Address プロパティは、HttpWebRequest.Address とは異な場合あります

Windows Mobile for Pocket PCWindows Mobile for SmartphoneWindows CE プラットフォームメモ : 追加ネットワーク伝送要求され要求送信されるまで、このプロパティnull 参照 (Visual Basic では Nothing) です。

使用例使用例
Private Shared Sub makeWebRequest(ByVal
 hashCode As Integer, ByVal
 Uri As String)
    Dim res As HttpWebResponse = Nothing

    ' Make sure that the idle time has elapsed, so that a new 
    ' ServicePoint instance is created.
    Console.WriteLine("Sleeping for 2 sec.")
    Thread.Sleep(2000)

    Try
        ' Create a request to the passed URI.
        Dim req As HttpWebRequest = CType(WebRequest.Create(Uri),
 HttpWebRequest)
        Console.WriteLine((ControlChars.Lf + "Connecting to "
 + Uri + " ............"))

        ' Get the response object.
        res = CType(req.GetResponse(), HttpWebResponse)
        Console.WriteLine("Connected." + ControlChars.Lf)
        Dim currentServicePoint As ServicePoint
 = req.ServicePoint

        ' Display new service point properties.
        Dim currentHashCode As Integer
 = currentServicePoint.GetHashCode()
        Console.WriteLine(("New service point hashcode: "
 + currentHashCode.ToString()))
        Console.WriteLine(("New service point max idle time: "
 + currentServicePoint.MaxIdleTime.ToString()))
        Console.WriteLine(("New service point is idle since "
 + currentServicePoint.IdleSince.ToString()))

        ' Check that a new ServicePoint instance has been created.
        If hashCode = currentHashCode Then
            Console.WriteLine("Service point reused.")
        Else
            Console.WriteLine("A new service point created.")
        End If
    Catch e As Exception
        Console.WriteLine(("Source : " + e.Source))
        Console.WriteLine(("Message : " + e.Message))
    Finally
        If Not (res Is Nothing)
 Then
            res.Close()
        End If
    End Try
End Sub 'makeWebRequest

private static void makeWebRequest
 (int hashCode, string Uri)
{
    HttpWebResponse res = null;

    // Make sure that the idle time has elapsed, so that a new 
    // ServicePoint instance is created.
    Console.WriteLine ("Sleeping for 2 sec.");
    Thread.Sleep (2000);
    try
    {
        // Create a request to the passed URI.
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create (Uri);

        Console.WriteLine ("\nConnecting to " + Uri + " ............");

        // Get the response object.
        res = (HttpWebResponse)req.GetResponse ();
        Console.WriteLine ("Connected.\n");

        ServicePoint currentServicePoint = req.ServicePoint;

        // Display new service point properties.
        int currentHashCode = currentServicePoint.GetHashCode
 ();

        Console.WriteLine ("New service point hashcode: " + currentHashCode);
        Console.WriteLine ("New service point max idle time: " + currentServicePoint.MaxIdleTime);
        Console.WriteLine ("New service point is idle since " + currentServicePoint.IdleSince
 );

        // Check that a new ServicePoint instance has been created.
        if (hashCode == currentHashCode)
            Console.WriteLine ("Service point reused.");
        else
            Console.WriteLine ("A new service point created.")
 ;
    }
    catch (Exception e)
    {
        Console.WriteLine ("Source : " + e.Source);
        Console.WriteLine ("Message : " + e.Message);
    }
    finally
    {
        if (res != null)
            res.Close ();
    }
}

void makeWebRequest( int hashCode, String^
 Uri )
{
   HttpWebResponse^ res = nullptr;
   
   // Make sure that the idle time has elapsed, so that a new 
   // ServicePoint instance is created.
   Console::WriteLine( "Sleeping for 2 sec." );
   Thread::Sleep( 2000 );
   try
   {
      
      // Create a request to the passed URI.
      HttpWebRequest^ req = dynamic_cast<HttpWebRequest^>(WebRequest::Create(
 Uri ));
      Console::WriteLine( "\nConnecting to {0} ............", Uri );
      
      // Get the response object.
      res = dynamic_cast<HttpWebResponse^>(req->GetResponse());
      Console::WriteLine( "Connected.\n" );
      ServicePoint^ currentServicePoint = req->ServicePoint;
      
      // Display new service point properties.
      int currentHashCode = currentServicePoint->GetHashCode();
      Console::WriteLine( "New service point hashcode: {0}", currentHashCode
 );
      Console::WriteLine( "New service point max idle time: {0}", currentServicePoint->MaxIdleTime
 );
      Console::WriteLine( "New service point is idle since {0}", currentServicePoint->IdleSince
 );
      
      // Check that a new ServicePoint instance has been created.
      if ( hashCode == currentHashCode )
            Console::WriteLine( "Service point reused." );
      else
            Console::WriteLine( "A new service point created."
 );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Source : {0}", e->Source );
      Console::WriteLine( "Message : {0}", e->Message );
   }
   finally
   {
      if ( res != nullptr )
            res->Close();
   }

}


private static void MakeWebRequest(int
 hashCode, String uri) 
    throws InterruptedException
{
    HttpWebResponse res = null;

    // Make sure that the idle time has elapsed, so that a new 
    // ServicePoint instance is created.
    Console.WriteLine("Sleeping for 2 sec.");
    Thread.sleep(2000);
    try {
        // Create a request to the passed URI.
        HttpWebRequest req = ((HttpWebRequest)(WebRequest.Create(uri)));
        Console.WriteLine(("\nConnecting to " + uri + " ............"));
        // Get the response object.
        res = ((HttpWebResponse)(req.GetResponse()));
        Console.WriteLine("Connected.\n");
        ServicePoint currentServicePoint = req.get_ServicePoint();

        // Display new service point properties.
        int currentHashCode = currentServicePoint.GetHashCode();

        Console.WriteLine(("New service point hashcode: " 
            + currentHashCode));
        Console.WriteLine(("New service point max idle time: " 
            + currentServicePoint.get_MaxIdleTime()));
        Console.WriteLine(("New service point is idle since " 
            + currentServicePoint.get_IdleSince()));

        // Check that a new ServicePoint instance has been created.
        if (hashCode == currentHashCode) {
            Console.WriteLine("Service point reused.");
        }
        else {
            Console.WriteLine("A new service point created.");
        }
    }
    catch (System.Exception e) {
        Console.WriteLine(("Source : " + e.get_Source()));
        Console.WriteLine(("Message : " + e.get_Message()));
    }
    finally {
        if ( res  != null  ) {
           res.Close();
        }
     }
} //MakeWebRequest
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS