IWMSOutgoingDistributionConnection.Status (Visual Basic .NET)

banner art

Previous Next

IWMSOutgoingDistributionConnection.Status (Visual Basic .NET)

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 that indicates 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 that 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

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub GetClientStatus()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Connections As IWMSOutgoingDistributionConnections
    Dim Connection As IWMSOutgoingDistributionConnection
    Dim pStatus As WMS_CLIENT_STATUS

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSOutgoingDistributionConnections object.
    Connections = Server.OutgoingDistributionConnections

    ' Retrieve information about each distribution connection.
    For Each Connection In Connections

        ' Retrieve the client status.
        pStatus = Connection.Status

        Select Case pStatus

            Case WMS_CLIENT_STATUS.WMS_CLIENT_DISCONNECTED
                ' TODO: Handle disconnected clients.
            Case WMS_CLIENT_STATUS.WMS_CLIENT_IDLE
                ' TODO: Handle idle clients.
            Case WMS_CLIENT_STATUS.WMS_CLIENT_OPEN
                ' TODO: Handle open clients.
            Case WMS_CLIENT_STATUS.WMS_CLIENT_STREAMING
                ' TODO: Handle streaming clients.
            Case Else
                ' TODO: Handle default case.
        End Select

    Next

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

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