Share via


WMS HTTP Server Control Protocol Plug-in Properties

A Windows Media server uses the WMS HTTP Server Control Protocol plug-in to communicate with clients through the HTTP 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 specify a port.

Visual Basic .NET Example

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

Private Sub SetHttpCPPluginProps() 

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

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

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

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

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

    ' Bind the plug-in to a specific port.
    CPAdmin.Port = 80

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 HTTP Server Control Protocol plug-in.
    Plugin = Server.ControlProtocols["WMS HTTP 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;

    // Bind the plug-in to a specific port.
    CPAdmin.Port = 80;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
    // TODO: Handle exceptions here.
}
finally
{
    // TODO: Perform clean-up here.
}

C++

#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;
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 HTTP Server Control Protocol plug-in.
varIndex = "WMS HTTP 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;

// Bind the plug-in to a specific port.
hr = pCPAdmin->put_Port(80);
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