ServicePointManager.FindServicePoint 메서드

정의

기존 개체를 ServicePoint 찾거나 이 요청에 대한 통신을 관리하는 새 ServicePoint 개체를 만듭니다.

오버로드

Name Description
FindServicePoint(Uri, IWebProxy)

기존 개체를 ServicePoint 찾거나 새 개체를 ServicePoint 만들어 지정된 Uri 개체와의 통신을 관리합니다.

FindServicePoint(Uri)

기존 개체를 ServicePoint 찾거나 새 개체를 ServicePoint 만들어 지정된 Uri 개체와의 통신을 관리합니다.

FindServicePoint(String, IWebProxy)

기존 개체를 ServicePoint 찾거나 지정된 URI(Uniform Resource Identifier)와의 통신을 관리하는 새 ServicePoint 개체를 만듭니다.

FindServicePoint(Uri, IWebProxy)

기존 개체를 ServicePoint 찾거나 새 개체를 ServicePoint 만들어 지정된 Uri 개체와의 통신을 관리합니다.

public:
 static System::Net::ServicePoint ^ FindServicePoint(Uri ^ address, System::Net::IWebProxy ^ proxy);
public static System.Net.ServicePoint FindServicePoint(Uri address, System.Net.IWebProxy proxy);
static member FindServicePoint : Uri * System.Net.IWebProxy -> System.Net.ServicePoint
Public Shared Function FindServicePoint (address As Uri, proxy As IWebProxy) As ServicePoint

매개 변수

address
Uri

Uri 연결할 인터넷 리소스의 주소를 포함하는 개체입니다.

proxy
IWebProxy

이 요청에 대한 프록시 데이터입니다.

반품

ServicePoint 요청에 대한 통신을 관리하는 개체입니다.

예외

addressnull입니다.

정의된 최대 개체 수 ServicePointMaxServicePoints 도달했습니다.

설명

이 메서드는 FindServicePoint 지정된 인터넷 호스트 이름과 연결된 개체를 반환 ServicePoint 합니다. 해당 호스트에 대한 개체가 없 ServicePoint 으면 개체가 개체를 ServicePointManager 만듭니다.

추가 정보

적용 대상

FindServicePoint(Uri)

기존 개체를 ServicePoint 찾거나 새 개체를 ServicePoint 만들어 지정된 Uri 개체와의 통신을 관리합니다.

public:
 static System::Net::ServicePoint ^ FindServicePoint(Uri ^ address);
public static System.Net.ServicePoint FindServicePoint(Uri address);
static member FindServicePoint : Uri -> System.Net.ServicePoint
Public Shared Function FindServicePoint (address As Uri) As ServicePoint

매개 변수

address
Uri

Uri 연결할 인터넷 리소스의 개체입니다.

반품

ServicePoint 요청에 대한 통신을 관리하는 개체입니다.

예외

addressnull입니다.

정의된 최대 개체 수 ServicePointMaxServicePoints 도달했습니다.

설명

이 메서드는 FindServicePoint 지정된 인터넷 호스트 이름과 연결된 개체를 반환 ServicePoint 합니다. 해당 호스트에 대한 개체가 없 ServicePoint 으면 개체가 개체를 ServicePointManager 만듭니다.

추가 정보

적용 대상

FindServicePoint(String, IWebProxy)

기존 개체를 ServicePoint 찾거나 지정된 URI(Uniform Resource Identifier)와의 통신을 관리하는 새 ServicePoint 개체를 만듭니다.

public:
 static System::Net::ServicePoint ^ FindServicePoint(System::String ^ uriString, System::Net::IWebProxy ^ proxy);
public static System.Net.ServicePoint FindServicePoint(string uriString, System.Net.IWebProxy proxy);
static member FindServicePoint : string * System.Net.IWebProxy -> System.Net.ServicePoint
Public Shared Function FindServicePoint (uriString As String, proxy As IWebProxy) As ServicePoint

매개 변수

uriString
String

연결할 인터넷 리소스의 URI입니다.

proxy
IWebProxy

이 요청에 대한 프록시 데이터입니다.

반품

ServicePoint 요청에 대한 통신을 관리하는 개체입니다.

예외

지정된 uriString URI가 잘못되었습니다.

정의된 최대 개체 수 ServicePointMaxServicePoints 도달했습니다.

예제

다음 코드 예제에서는 개체에 액세스 하려면이 메서드를 호출 하는 방법을 보여 줍니다 ServicePoint .

public static void Main(string[] args)
{
    int port = 80;

    // Define a regular expression to parse the user's input.
    // This is a security check. It allows only
    // alphanumeric input strings between 2 to 40 characters long.
    Regex rex = new Regex(@"^[a-zA-Z]\w{1,39}$");

    if (args.Length < 1)
    {
        showUsage();
        return;
    }
    string proxy = args[0];

    if (!(rex.Match(proxy)).Success)
    {
        Console.WriteLine("Input string format not allowed.");
        return;
    }
    string proxyAdd = "http://" + proxy + ":" + port;

    // Create a proxy object.
    WebProxy DefaultProxy = new WebProxy(proxyAdd, true);

    // Set the proxy that all HttpWebRequest instances use.
    WebRequest.DefaultWebProxy = DefaultProxy;

    // Get the base interface for proxy access for the
    // WebRequest-based classes.
    IWebProxy Iproxy = WebRequest.DefaultWebProxy;

    // Set the maximum number of ServicePoint instances to
    // maintain. If a ServicePoint instance for that host already
    // exists when your application requests a connection to
    // an Internet resource, the ServicePointManager object
    // returns this existing ServicePoint instance. If none exists
    // for that host, it creates a new ServicePoint instance.
    ServicePointManager.MaxServicePoints = 4;

    // Set the maximum idle time of a ServicePoint instance to 10 seconds.
    // After the idle time expires, the ServicePoint object is eligible for
    // garbage collection and cannot be used by the ServicePointManager object.
    ServicePointManager.MaxServicePointIdleTime = 10000;

    ServicePointManager.UseNagleAlgorithm = true;
    ServicePointManager.Expect100Continue = true;
    ServicePointManager.CheckCertificateRevocationList = true;
    ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;
    // Create the Uri object for the resource you want to access.
    Uri MS = new Uri("http://msdn.microsoft.com/");

    // Use the FindServicePoint method to find an existing
    // ServicePoint object or to create a new one.
    ServicePoint servicePoint = ServicePointManager.FindServicePoint(MS, Iproxy);

    ShowProperties(servicePoint);

    int hashCode = servicePoint.GetHashCode();

    Console.WriteLine("Service point hashcode: " + hashCode);

    // Make a request with the same scheme identifier and host fragment
    // used to create the previous ServicePoint object.
    makeWebRequest(hashCode, "http://msdn.microsoft.com/library/");
}
' This is the program entry point. It allows the user to enter 
' a server name that is used to locate its current homepage.
Public Shared Sub Main(ByVal args() As String)
    Dim proxy As String = Nothing
    Dim port As Integer = 80

    ' Define a regular expression to parse the user's input.
    ' This is a security check. It allows only
    ' alphanumeric input strings between 2 to 40 characters long.
    Dim rex As New Regex("^[a-zA-Z]\w{1,39}$")

    If args.Length = 0 Then
        ' Show how to use this program.
        showUsage()
        Return
    End If

    proxy = args(0)
    If (Not (rex.Match(proxy)).Success) Then
        Console.WriteLine("Input string format not allowed.")
        Return
    End If

    ' Create a proxy object.  
    Dim proxyAdd As String
    proxyAdd = "http://" + proxy + ":" + port.ToString()


    Dim DefaultProxy As New WebProxy(proxyAdd, True)

    ' Set the proxy that all HttpWebRequest instances use.
    WebRequest.DefaultWebProxy = DefaultProxy


    ' Get the base interface for proxy access for the 
    ' WebRequest-based classes.
    Dim Iproxy As IWebProxy = WebRequest.DefaultWebProxy

    ' Set the maximum number of ServicePoint instances to maintain.
    ' Note that, if a ServicePoint instance for that host already 
    ' exists when your application requests a connection to
    ' an Internet resource, the ServicePointManager object
    ' returns this existing ServicePoint. If none exists 
    ' for that host, it creates a new ServicePoint instance.
    ServicePointManager.MaxServicePoints = 4

    ' Set the maximum idle time of a ServicePoint instance to 10 seconds.
    ' After the idle time expires, the ServicePoint object is eligible for
    ' garbage collection and cannot be used by the ServicePointManager.
    ServicePointManager.MaxServicePointIdleTime = 10000


    ServicePointManager.UseNagleAlgorithm = True
    ServicePointManager.Expect100Continue = True
    ServicePointManager.CheckCertificateRevocationList = True
    ServicePointManager.DefaultConnectionLimit = _
        ServicePointManager.DefaultPersistentConnectionLimit
    ' Create the Uri object for the resource you want to access.
    Dim MS As New Uri("http://msdn.microsoft.com/")

    ' Use the FindServicePoint method to find an existing 
    ' ServicePoint object or to create a new one.   
    Dim servicePoint As ServicePoint = ServicePointManager.FindServicePoint(MS, Iproxy)
    ShowProperties(servicePoint)
    Dim hashCode As Integer = servicePoint.GetHashCode()
    Console.WriteLine(("Service point hashcode: " + hashCode.ToString()))

    ' Make a request with the same scheme identifier and host fragment
    ' used to create the previous ServicePoint object.
    makeWebRequest(hashCode, "http://msdn.microsoft.com/library/")

End Sub

설명

이 메서드는 FindServicePoint 지정된 인터넷 호스트 이름과 연결된 개체를 반환 ServicePoint 합니다. 해당 호스트에 대한 개체가 없 ServicePoint 으면 개체가 개체를 ServicePointManager 만듭니다.

추가 정보

적용 대상