Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Windows Media Server / April 2004

Tip: Looking for answers? Try searching our database.

Script to change limit settings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ron - 26 Apr 2004 15:46 GMT
Does anyone have an example Script to change the limit settings in
Windows media service on Windows 2003?

Tnx
David Chen [MS] - 26 Apr 2004 19:04 GMT
Tnx:
Please see WIndows Media Server SDK from
http://www.microsoft.com/windows/windowsmedia/download/default.asp.  There
are example of
Setting Publishing Point Limits like this:

By setting publishing point limits, you can control and distribute resource
usage across multiple publishing points. For example, you can put limits on
one publishing point to ensure enough available resources for a higher
priority publishing point. Use the IWMSPublishingPointLimits object to
specify and retrieve these limit values.

The following examples illustrate how to control resource usage per
publishing point by setting various publishing point limit values.

Visual Basic .NET Example

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

' Declare variables.
Dim Server As WMSServer
Dim Limits As IWMSPublishingPointLimits
Dim lCount As Long
Dim i As Long

Try
   ' Create the WMSServer object and retrieve the
   ' number of publishing points.
   Server = New WMSServer()

   lCount = Server.PublishingPoints.Count

   ' Set limits for each publishing point.
   For i = 0 To (lCount - 1)
       ' Retrieve the IWMSPublishingPointLimits object.
       Limits = Server.PublishingPoints.Item(i).Limits
       ' Set the maximum number of connected clients.
       Limits.ConnectedPlayers = 10
       ' Set the maximum bandwidth usage for each client.
       Limits.PerPlayerConnectionBandwidth = 128
       ' Set the maximum content-delivery rate for each client.
       Limits.PlayerCacheDeliveryRate = 5000
   Next

Catch errCom As COMException
   ' TODO: Handle COM exceptions.
Catch err As Exception
   ' TODO: Exception handler goes here.
Finally
   ' TODO: Clean-up code goes here.
End Try

C# Example

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

WMSServer Server;
IWMSPublishingPointLimits Limits;
long lCount;
int i;

try
{
   // Create the WMSServer object and retrieve the
   // number of publishing points.
   Server = new WMSServerClass();

   lCount = Server.PublishingPoints.Count;

   // Set limits for each publishing point.
   for (i = 0; i < lCount; i++)
   {
       // Retrieve the IWMSPublishingPointLimits object.
       Limits = Server.PublishingPoints[i].Limits;

       // Set the maximum number of connected clients.
       Limits.ConnectedPlayers = 10;

       // Set the maximum bandwidth usage for each client.
       Limits.PerPlayerConnectionBandwidth = 128;

       // Set the maximum content-delivery rate for each client.
       Limits.PlayerCacheDeliveryRate = 5000;
   }
}
catch (COMException comExc)
{
   // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
   // TODO: Exception handler goes here.
}
finally
{
   // TODO: Clean-up code goes here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer                *pServer;
IWMSPublishingPoints      *pPubPoints;
IWMSPublishingPoint       *pPubPoint;
IWMSPublishingPointLimits *pLimits;

HRESULT         hr;
CComVariant     varIndex;
long            lCount;
int             x;

// 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 IWMSPublishingPoints
// interface and retrieve the number of publishing
// points.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;
hr = pPubPoints->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Set limits for each publishing point.
for (x = 0; x < lCount; x++)
{  
   // Retrieve a pointer to the next
   // IWMSPublishingPoint interface.
   varIndex = x;
   hr = pPubPoints->get_Item(varIndex, &pPubPoint);
   if (FAILED(hr)) goto EXIT;

   // Retrieve a pointer to the IWMSPublishingPointLimits
   // interface.
   hr = pPubPoint->get_Limits(&pLimits);
   if (FAILED(hr)) goto EXIT;

   // Set the maximum number of connected clients.
   hr = pLimits->put_ConnectedPlayers(10);
   if (FAILED(hr)) goto EXIT;

   // Set the maximum bandwidth usage for each client.
   hr = pLimits->put_PerPlayerConnectionBandwidth(128);
   if (FAILED(hr)) goto EXIT;

   // Set the maximum content-delivery rate for each client.
   hr = pLimits->put_PlayerCacheDeliveryRate(5000);
   if (FAILED(hr)) goto EXIT;

   // Release objects.
   pPubPoint->Release();
   pLimits->Release();
}

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

Thanks for using WIndows Media Services

David Chen
Digital Media Division
This posting is provided "AS IS" with no warranties, and confers no rights
Ron - 27 Apr 2004 07:29 GMT
>Tnx:
>Please see WIndows Media Server SDK from
[quoted text clipped - 10 lines]
>The following examples illustrate how to control resource usage per
>publishing point by setting various publishing point limit values.

Tnx, but I am not much of a developer..:(
What I was hoping for was a VBScript or something, what I need to do
is setup a schedule to provide more client connections for 1 stream on
the weekend than during the week..

Grtz
Ravi Raman - 27 Apr 2004 18:57 GMT
Here is a sample script that will limit the number of
player connections on a publishing point called "MyPubPt"
to 10.

set SrvObj = createobject("WMSServer.server")
set pubPt = srvobj.PublishingPoints("MyPubPt")
set pubLimits = pubpt.Limits
pubLimits.ConnectedPlayers = 10

Ravi
--
This posting is provided "AS IS" with no warranties, and
confers no rights. Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

>-----Original Message-----
>
[quoted text clipped - 21 lines]
>
>.
Ron - 28 Apr 2004 10:42 GMT
>Here is a sample script that will limit the number of
>player connections on a publishing point called "MyPubPt"
[quoted text clipped - 4 lines]
>set pubLimits = pubpt.Limits
>pubLimits.ConnectedPlayers = 10

Tnx,
Exactly what we need
It works great..:)

Ron
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.