Compartir a través de


Using the IWMSAdminUnicastSink Interface

You can use the IWMSAdminUnicastSink interface to configure the plug-in. This interface exposes the following properties.

Property

Description

DataProtocols

Retrieves a semicolon-delimited list of the data protocols supported by the WMS Unicast Data Writer plug-in.

DefaultPacketSize

Specifies and retrieves a Boolean value indicating whether the network packet size should default to the packet size of the content being delivered.

MaximumPacketSize

Specifies and retrieves the maximum packet size that can be sent by the unicast data sink.

OptimalPacketSize

Specifies and retrieves the optimal packet size sent by the unicast data sink.

TCPEnabled

Specifies and retrieves a Boolean value indicating whether the unicast data sink can use TCP when selecting a streaming protocol.

ThirdPartyStreamingEnabled

Specifies and retrieves a Boolean value indicating whether UDP packets can be sent to an IP address that differs from the address of the client's TCP connection.

UDPEnabled

Specifies and retrieves a Boolean value indicating whether the unicast data sink can use UDP when selecting a streaming protocol.

The following examples illustrate how to use the IWMSAdminUnicastSink interface to specify the properties of the WMS Unicast Data Writer plug-in.

Visual Basic .NET Example

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

Private Sub SetUnicastPluginProps() 

' Declare variables.
Dim Server As WMSServer
Dim Plugin As IWMSPlugin
Dim AdminUnicastSink As IWMSAdminUnicastSink

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

    ' Retrieve the WMS Unicast Data Writer plug-in.
    Plugin = Server.UnicastDataSinks("WMS Unicast Data Writer")

    ' Retrieve the administration interface for the plug-in.
    AdminUnicastSink = Plugin.CustomInterface

    ' Set the largest packet size that can be
    ' sent by the unicast data sink.
    AdminUnicastSink.MaximumPacketSize = 1452
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;
IWMSAdminUnicastSink AdminUnicastSink;

try
{
    // Create a new WMSServer object.
    Server = new WMSServerClass();
    
    // Retrieve the WMS Unicast Data Writer plug-in.
    Plugin = Server.UnicastDataSinks["WMS Unicast Data Writer"];
    
    // Retrieve the administrative interface for the plug-in.
    AdminUnicastSink = (IWMSAdminUnicastSink)Plugin.CustomInterface;
    
    // Set the largest packet size that can be
    // sent by the unicast data sink.
    AdminUnicastSink.MaximumPacketSize = 1452;
}
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;
IWMSAdminUnicastSink*          pAdminUnicastSink = NULL;
CComVariant                    varIndex;
CComBSTR                       bstrValue;
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 the IWMSPlugins interface
// containing the collection of unicast data writer plug-ins.
hr = pServer->get_UnicastDataSinks(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface for the 
// WMS Unicast Data Writer plug-in.
varIndex = "WMS Unicast Data Writer";
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 
// IWMSAdminUnicastSink interface.
hr = pDispatch->QueryInterface(IID_IWMSAdminUnicastSink, (void**)&pAdminUnicastSink);
if (FAILED(hr)) goto EXIT;

// Set a Boolean value indicating whether UDP
// can be used as a streaming protocol.
hr = pAdminUnicastSink->put_UDPEnabled(VARIANT_TRUE);
if (FAILED(hr)) goto EXIT;

// Set the maximum packet size that can be
// sent by the unicast data sink.
hr = pAdminUnicastSink->put_MaximumPacketSize(1452);
if (FAILED(hr)) goto EXIT;

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

See Also

Reference

IWMSAdminUnicastSink Interface

IWMSAdminUnicastSink Object (C#)

IWMSAdminUnicastSink Object (Visual Basic .NET)

Concepts

WMS Unicast Data Writer Plug-in Properties