ServicePoint.MaxIdleTime Свойство

Определение

Возвращает или задает промежуток времени, в течение которого подключение, связанное с объектом ServicePoint, может находиться в состоянии простоя до своего закрытия.

public:
 property int MaxIdleTime { int get(); void set(int value); };
public int MaxIdleTime { get; set; }
member this.MaxIdleTime : int with get, set
Public Property MaxIdleTime As Integer

Значение свойства

Временной промежуток в миллисекундах, в течение которого подключение, связанное с объектом ServicePoint, будет простаивать до его закрытия и повторного использования.

Исключения

MaxIdleTime Параметр имеет значение меньше или больше, чем InfiniteInt32.MaxValue.

Примеры

В следующем примере кода свойство используется MaxIdleTime для задания и извлечения ServicePoint времени простоя.

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );
// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

Комментарии

Можно задать значение MaxIdleTime , Timeout.Infinite чтобы указать, что соединение, связанное ServicePoint с объектом, никогда не должно истекать.

Значение MaxIdleTime свойства по умолчанию — это значение ServicePointManager.MaxServicePointIdleTime свойства при ServicePoint создании объекта . Последующие MaxServicePointIdleTime изменения свойства не влияют на существующие ServicePoint объекты.

При превышении MaxIdleTime для соединения, связанного с ServicePoint , соединение остается открытым до тех пор, пока приложение не попытается использовать подключение. В это время платформа закрывает подключение и создает новое подключение к удаленному узлу.

Применяется к