IWMSServerLimits.PlayerInactivityTimeout (C#)

The PlayerInactivityTimeout property specifies and retrieves the maximum length of time that a player is permitted to remain connected without receiving streamed content.

IWMSServerLimits.PlayerInactivityTimeout = int;int = IWMSServerLimits.PlayerInactivityTimeout;

Property Value

int containing the permitted connection time in seconds.

If this property fails, it throws an exception.




int is an invalid argument.


This property applies only to new connections. Existing connections are controlled by the inactivity time-out specified when they connected. If the parameter is –1, there is no time-out limit. By default, the value of the parameter is 86,400 seconds (24 hours). The value zero is not valid for the return value.


using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                  Server;
IWMSServerLimits           ServerLimits;

int                       iValue;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSServerLimits object for the server.
    ServerLimits = Server.Limits;

    // Retrieve the maximum amount of time a client
    // can stay idle before being disconnected.
    iValue = ServerLimits.PlayerInactivityTimeout;

    // Set the maximum amount of time a client
    // can stay idle before being disconnected.
    ServerLimits.PlayerInactivityTimeout = 4000;
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
catch (Exception e) {
    // TODO: Handle exceptions.


Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also


IWMSServerLimits Object (C#)