Freigeben über


MulticastOption-Konstruktor (IPAddress, IPAddress)

Initialisiert eine neue Instanz der MulticastOption-Klasse mit der Adresse der angegebenen IP-Multicast-Gruppe und der angegebenen lokalen IP-Adresse, die einer Netzwerkschnittstelle zugeordnet ist.

Namespace: System.Net.Sockets
Assembly: System (in system.dll)

Syntax

'Declaration
Public Sub New ( _
    group As IPAddress, _
    mcint As IPAddress _
)
'Usage
Dim group As IPAddress
Dim mcint As IPAddress

Dim instance As New MulticastOption(group, mcint)
public MulticastOption (
    IPAddress group,
    IPAddress mcint
)
public:
MulticastOption (
    IPAddress^ group, 
    IPAddress^ mcint
)
public MulticastOption (
    IPAddress group, 
    IPAddress mcint
)
public function MulticastOption (
    group : IPAddress, 
    mcint : IPAddress
)

Parameter

  • mcint
    Die lokale IPAddress.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentNullException

group ist NULL (Nothing in Visual Basic).

– oder –

mcint ist NULL (Nothing in Visual Basic).

Hinweise

Für Computer mit mehreren Netzwerkkarten müssen Sie diesen Konstruktor zum Erstellen von MulticastOption-Instanzen verwenden.

Beispiel

Im folgenden Beispiel wird ein MulticastOption-Objekt erstellt.

' Define a MulticastOption object specifying the multicast group 
' address and the local IPAddress.
' The multicast group address is the same as the address used by the server.
mcastOption = New MulticastOption(mcastAddress, localIPAddr)

mcastSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, mcastOption)
 
// Define a MulticastOption object specifying the multicast group 
// address and the local IPAddress.
// The multicast group address is the same as the address used by the server.
mcastOption = new MulticastOption(mcastAddress, localIPAddr);

mcastSocket.SetSocketOption(SocketOptionLevel.IP, 
                            SocketOptionName.AddMembership, 
                            mcastOption);
// Define a MuticastOption object specifying the multicast group
// address and the local IPAddress.
// The multicast group address is the same one used by the server.
mcastOption = gcnew MulticastOption( mcastAddress,localIPAddr );
mcastSocket->SetSocketOption( SocketOptionLevel::IP, SocketOptionName::AddMembership, mcastOption );
// Define a MulticastOption object specifying the multicast group
// address and the local IPAddress.
// The multicast group address is the same as the
// address used by the server.
mcastOption = new MulticastOption(mcastAddress, localIPAddr);
mcastSocket.SetSocketOption(SocketOptionLevel.IP,
    SocketOptionName.AddMembership, mcastOption);

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

MulticastOption-Klasse
MulticastOption-Member
System.Net.Sockets-Namespace