IWMSPlayer.Port (Visual Basic .NET)

banner art

Previous Next

IWMSPlayer.Port (Visual Basic .NET)

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


  Integer = IWMSPlayer.Port

Property Value

Integer that contains the port number.


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, or the router if these are in the network path.

This property is read-only.

Example Code

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

Private Sub GetPort()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Players As IWMSPlayers
    Dim Player As IWMSPlayer
    Dim iValue As Integer

    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlayers object.
    Players = Server.Players

    ' Retrieve information about each client connection.
    For Each Player In Players
        ' Retrieve the port of the client.
        iValue = Player.Port

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
    ' TODO: Clean-up code goes here.
End Try

End Sub


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