Compartir a través de


WMS RTSP Server Control Protocol Plug-in Properties

A Windows Media server uses the WMS RTSP Server Control Protocol plug-in to communicate with clients through the RTSP protocol. For administration information about this plug-in, see Windows Media Services Help.

There are two interfaces that you can use to configure the plug-in programmatically. The IWMSBoundIPAddresses interface contains a collection of IP addresses through which the protocol communicates. This interface exposes the following methods.

Method

Description

Add

Adds a new address to the collection.

RemoveAll

Removes all IP addresses from the collection.

The IWMSCPPluginAdmin interface exposes the following properties.

Property

Description

BoundIPAddresses

Retrieves an IWMSBoundIPAddresses object containing a collection of IP addresses that the protocol is bound to.

ControlProtocol

Retrieves the name of the protocol.

ListenAllIPAddresses

Specifies and retrieves a Boolean value indicating whether the server must monitor all IP addresses for incoming client requests.

Port

Specifies and retrieves the port number used by the protocol.

The following examples illustrate how to use the IWMSCPPluginAdmin interface to retrieve a list of the bound IP addresses and the name of the protocol.

Visual Basic .NET Example

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

Private Sub SetRtspCPPluginProps() 

' Declare variables.
Dim Server As WMSServer
Dim Plugin As IWMSPlugin
Dim CPAdmin As IWMSCPPluginAdmin
Dim BoundIPAddr As IWMSBoundIPAddresses
Dim strProtocol As String

Try
    ' Create a new WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlugin object for the
    ' WMS RTSP Server Control Protocol plug-in.
    Plugin = Server.ControlProtocols("WMS RTSP Server Control Protocol")

    ' Retrieve the administrative interface for the plug-in.
    CPAdmin = Plugin.CustomInterface()

    ' Retrieve the list of bound IP addresses.
    BoundIPAddr = CPAdmin.BoundIPAddresses

    ' Retrieve the name of the protocol used
    ' by the plug-in.
    strProtocol = CPAdmin.ControlProtocol
Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle exceptions here.
Finally
    ' TODO: Perform clean-up here.
End Try

End Sub 

C# Example

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

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSCPPluginAdmin CPAdmin;
IWMSBoundIPAddresses BoundIPAddr;

try
{
    // Create a new WMSServer object.
    Server = new WMSServerClass();
    
    // Retrieve the IWMSPlugin object for the
    // WMS RTSP Server Control Protocol plug-in.
    Plugin = Server.ControlProtocols["WMS RTSP Server Control Protocol"];
    
    // Retrieve the administrative interface for the plug-in.
    CPAdmin = (IWMSCPPluginAdmin)Plugin.CustomInterface;
    
    // Retrieve the list of bound IP addresses.
    BoundIPAddr = CPAdmin.BoundIPAddresses;
    
    // Retrieve the name of the protocol used by the plug-in.
    string strProtocol = CPAdmin.ControlProtocol;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
    // TODO: Handle exceptions here.
}
finally
{
    // TODO: Perform clean-up here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>

// To access system plug-in interfaces, the
// type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
                               raw_interfaces_only

// Declare variables and interface pointers.
IWMSServer*             pServer = NULL;
IWMSPlugins*            pPlugins = NULL;
IWMSPlugin*             pPlugin = NULL;
IDispatch*              pDispatch = NULL;
IWMSCPPluginAdmin*      pCPAdmin = NULL;
IWMSBoundIPAddresses*   pBoundIPAddresses = NULL;
CComVariant             varIndex;
CComBSTR                bstrProtocol;
HRESULT                 hr = S_OK;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlugins interface
// containing the collection of control protocol plug-ins.
hr = pServer->get_ControlProtocols(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface for the
// WMS RTSP Server Control Protocol plug-in.
varIndex = "WMS RTSP Server Control Protocol";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;

// Retrieve an IDispatch pointer to the administration
// interface for the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;

// Call QueryInterface() to retrieve a pointer to the
// IWMSCPPluginAdmin interface.
hr = pDispatch->QueryInterface(IID_IWMSCPPluginAdmin, (void**)&pCPAdmin);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the list of bound IP addresses.
hr = pCPAdmin->get_BoundIPAddresses(&pBoundIPAddresses);
if (FAILED(hr)) goto EXIT;

// Retrieve the protocol name supported by the plug-in.
hr = pCPAdmin->get_ControlProtocol(&bstrProtocol);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Reference

IWMSBoundIPAddresses Interface

IWMSBoundIPAddresses Object (C#)

IWMSBoundIPAddresses Object (Visual Basic .NET)

IWMSCPPluginAdmin Interface

IWMSCPPluginAdmin Object (C#)

IWMSCPPluginAdmin Object (Visual Basic .NET)

Concepts

Programming System Plug-in Properties