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

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

FtpWebRequest.ServicePoint プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

FTP サーバー接続するために使用する ServicePoint オブジェクト取得します

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

解説解説
使用例使用例

要求からサービス ポイント取得しサービス ポイントへの接続最大数を設定するコード例次に示します

public static bool ListFilesOnServer(Uri
 serverUri)
{
    // The serverUri should start with the ftp:// scheme.
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }
    // Get the object used to communicate with the server.
    FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri);
    request.Method = WebRequestMethods.Ftp.ListDirectory;
    
    // Get the ServicePoint object used for this request, and limit
 it to one connection.
    // In a real-world application you might use the default number
 of connections (2),
    // or select a value that works best for your application.
    
    ServicePoint sp = request.ServicePoint;
    Console.WriteLine("ServicePoint connections = {0}.", sp.ConnectionLimit);
    sp.ConnectionLimit = 1;
    
    FtpWebResponse response = (FtpWebResponse) request.GetResponse();
     
    // The following streams are used to read the data returned from
 the server.
    Stream responseStream = null;
    StreamReader readStream = null;
    try
    {
        responseStream = response.GetResponseStream(); 
        readStream = new StreamReader(responseStream, System.Text.Encoding.UTF8);
 
        if (readStream != null)
        {
            // Display the data received from the server.
            Console.WriteLine(readStream.ReadToEnd());
        } 
        Console.WriteLine("List status: {0}",response.StatusDescription);
            
    }
    finally
    {
        if (readStream != null)
        {
            readStream.Close();
        }
        if (response != null)
        {
            response.Close();
        }
    }
   
    return true;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FtpWebRequest クラス
FtpWebRequest メンバ
System.Net 名前空間
FtpWebResponse
FtpStatusCode 列挙
WebRequestMethods.Ftp
WebRequest
WebResponse
WebClient



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS