IWMSPlayer.Port (C#)

banner art

Previous Next

IWMSPlayer.Port (C#)

The Port property retrieves the port number of the client receiving content from the server.

Syntax

  int = IWMSPlayer.Port;

Property Value

int containing the port number.

Remarks

The network address is returned by the socket on the Windows Media server. Therefore, the address can be that of the player receiving the content, but it can also be the address of the firewall, the network address translator (NAT), or the router, if these are in the network path.

This property is read-only.

Example Code

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

// Declare variables.
WMSServer          Server;
IWMSPlayers        Players;
IWMSPlayer         Player;

int               iValue;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPlayers object.
    Players = Server.Players;

    // Retrieve information about each client connection.
    for (int i = 0; i < Players.Count; i++)
    {
        Player = Players[i];

        // Retrieve the port of the client.
        iValue = Player.Port;
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

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