IWMSOutgoingDistributionConnection.Status (C#)

banner art

Previous Next

IWMSOutgoingDistributionConnection.Status (C#)

The Status property retrieves the status of the client.

Syntax

  WMS_CLIENT_STATUS = IWMSOutgoingDistributionConnection.Status;

Property Value

A member of the WMS_CLIENT_STATUS enumeration type indicating the current state of the client that is connected to this stream. This must be one of the following values.

Value Description
WMS_CLIENT_DISCONNECTED The client has been disconnected.
WMS_CLIENT_IDLE The client is connected to the server but no content is being streamed.
WMS_CLIENT_OPEN The client is connected to the server and a resource has been opened to stream. Clients that send a pause or stop command will also have this status.
WMS_CLIENT_STREAMING The client is connected to the server and content is being streamed.

Remarks

This property is read-only. If a client has been disconnected, you can use IWMSOutgoingDistributionConnections.Refresh to update the IWMSOutgoingDistributionConnections collection.

Example Code

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

// Declare variables.
WMSServer                              Server;
IWMSOutgoingDistributionConnections    Connections;
IWMSOutgoingDistributionConnection     Connection;

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

    // Retrieve the IWMSOutgoingDistributionConnections object.
    Connections = Server.OutgoingDistributionConnections;

    // Retrieve information about each distribution connection.
    for (int i = 0; i < Connections.Count; i++)
    {
        Connection = Connections[i];

        // Retrieve the client status.
        WMS_CLIENT_STATUS pStatus;
        pStatus = Connection.Status;

        switch (pStatus)
        {
            case WMS_CLIENT_STATUS.WMS_CLIENT_DISCONNECTED:
                // TODO: Handle disconnected clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_IDLE:
                // TODO: Handle idle clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_OPEN:
                // TODO: Handle open clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_STREAMING:
                // TODO: Handle streaming clients.
                break;
        }
    }
}
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.

See Also

Previous Next