System.Net.Sockets.MulticastOption Class

public class MulticastOption

Base Types

Object
  MulticastOption

Assembly

System

Library

Networking

Summary

Contains Internet Protocol (IP) addresses used when joining or leaving an IP multicast group.

Description

Collectively, the hosts listening to a specific IP multicast address (the group address) are called a multicast group. Each member of the group receives any IP messages sent to the group address.

An instance of this class is passed into the System.Net.Sockets.Socket.SetSocketOption(System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,System.Int32) method and returned by the System.Net.Sockets.Socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName) method when the optionName parameter is set to System.Net.Sockets.SocketOptionName.AddMembership or System.Net.Sockets.SocketOptionName.DropMembership.

See Also

System.Net.Sockets Namespace

Members

MulticastOption Constructors

MulticastOption(System.Net.IPAddress, System.Net.IPAddress) Constructor
MulticastOption(System.Net.IPAddress) Constructor

MulticastOption Properties

MulticastOption.Group Property
MulticastOption.LocalAddress Property


MulticastOption(System.Net.IPAddress, System.Net.IPAddress) Constructor

public MulticastOption(IPAddress group, IPAddress mcint);

Summary

Constructs and initializes a new instance of the MulticastOption class with the specified IP multicast group and local addresses.

Parameters

group
An instance of IPAddress containing the group IP address.
mcint
An instance of IPAddress containing the local IP address.

Exceptions

Exception TypeCondition
ArgumentNullExceptiongroup or mcint is null .

Description

The System.Net.Sockets.MulticastOption.Group property is set to group and the System.Net.Sockets.MulticastOption.LocalAddress property is set to mcint.

See Also

System.Net.Sockets.MulticastOption Class, System.Net.Sockets Namespace

MulticastOption(System.Net.IPAddress) Constructor

public MulticastOption(IPAddress group);

Summary

Constructs and initializes a new instance of the MulticastOption class with the specified IP multicast group address.

Parameters

group
An instance of IPAddress containing the IP address of a multicast group.

Exceptions

Exception TypeCondition
ArgumentNullExceptiongroup is null .

Description

This constructor initializes the System.Net.Sockets.MulticastOption.Group property of the new instance using group. The System.Net.Sockets.MulticastOption.LocalAddress property is initialized to System.Net.IPAddress.Any. Any allows the protocol to decide which local IP address to use.

See Also

System.Net.Sockets.MulticastOption Class, System.Net.Sockets Namespace

MulticastOption.Group Property

public IPAddress Group { get; set; }

Summary

Gets or sets the IP address of a multicast group.

Property Value

An instance of IPAddress containing the IP address of a multicast group.

Description

Collectively, the hosts listening to a specific IP multicast address are called a multicast group. Each member of the group receives any IP messages sent to this address.

[Note: Valid IP addresses for multicast groups are in the range 224.0.0.0 to 239.255.255.255 with some addresses reserved for special purposes.

]

See Also

System.Net.Sockets.MulticastOption Class, System.Net.Sockets Namespace

MulticastOption.LocalAddress Property

public IPAddress LocalAddress { get; set; }

Summary

Gets or sets the local IP address to receive data.

Property Value

An instance of IPAddress containing the local IP address.

Description

This property specifies the local IP address used to receive data sent to the multicast group.

See Also

System.Net.Sockets.MulticastOption Class, System.Net.Sockets Namespace