IWMSPublishingPointCurrentCounters.AllCounters (C#)

banner art

Previous Next

IWMSPublishingPointCurrentCounters.AllCounters (C#)

The AllCounters property retrieves an array that contains all of the counters supported by the object.

Syntax

  object[,] = IWMSPublishingPointCurrentCounters.AllCounters;

Property Value

An object array containing the counters.

Remarks

This property is read-only.

The array is two-dimensional. The first element in each row contains the name of the counter property, and the second element in each row contains the value. The AllCounters property is used to speed up counter retrieval during remote administration, by making one call instead of multiple calls to retrieve multiple counter properties.

The properties returned by the array are shown in the following table.

Property Description
ConnectedPlayers Retrieves the total number of players connected to the publishing point.
OutgoingDistributionAllocatedBandwidth Retrieves the bandwidth allocated for distribution connections.
OutgoingDistributionConnections Retrieves the total number of distribution connections.
PlayerAllocatedBandwidth Retrieves the bandwidth allocated for player connections.
StreamingHTTPPlayers Retrieves the total number of players receiving streamed content by using the HTTP protocol.
StreamingMMSPlayers Retrieves the total number of players receiving streamed content by using the MMS protocol. (The MMS protocol is not supported in Windows Server 2008 operating systems.)
StreamingPlayers Retrieves the total number of players receiving streamed content from the publishing point.
StreamingRTSPPlayers Retrieves the total number of players receiving streamed content by using the RTSP protocol.
StreamingUDPPlayers Retrieves the total number of players receiving streamed content by using the User Datagram Protocol (UDP).

Example Code

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

// Declare variables.
WMSServer                            Server;
IWMSPublishingPoints                 PubPoints;
IWMSPublishingPoint                  PubPoint;
IWMSPublishingPointCurrentCounters   CurrentCounters;

object[,]                            aAllCounters;

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

    // Retrieve the IWMSPublishingPoints object.
    PubPoints = Server.PublishingPoints;

    // Retrieve information about each publishing point.
    for (int i = 0; i < PubPoints.Count; i++)
    {
        PubPoint = PubPoints[i];

        // Retrieve a list of current statistics
        // for the publishing point.
        CurrentCounters = PubPoint.CurrentCounters;

        // Retrieve an array of all the counters in this object.
        aAllCounters = (object[,])CurrentCounters.AllCounters;

        // Process each array element.
        for (int j = aAllCounters.GetLowerBound(0); j <= 
                   aAllCounters.GetUpperBound(0); j++)
        {
            for (int k = aAllCounters.GetLowerBound(1); k <= 
                       aAllCounters.GetUpperBound(1); k++)
            {
                object varValue; 
                varValue = aAllCounters[j, k];

                if (varValue.GetType().ToString() == "System.String")
                {
                    // TODO: Handle counter names.
                }

                if (varValue.GetType().ToString() == "System.Int32")
                {
                    // TODO: Handle counter values.
                }
            }
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

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.

  • Note   Some counters are not available in the Windows Server 2003 family.

See Also

Previous Next