Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Sockets / MulticastOption.cs / 1305376 / MulticastOption.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Sockets {
using System.Net;
///
///
/// Contains option values
/// for IP multicast packets.
///
///
public class MulticastOption {
IPAddress group;
IPAddress localAddress;
int ifIndex;
///
///
/// Creates a new instance of the MulticaseOption class with the specified IP
/// address group and local address.
///
///
public MulticastOption(IPAddress group, IPAddress mcint) {
if (group == null) {
throw new ArgumentNullException("group");
}
if (mcint == null) {
throw new ArgumentNullException("mcint");
}
Group = group;
LocalAddress = mcint;
}
public MulticastOption(IPAddress group, int interfaceIndex) {
if (group == null) {
throw new ArgumentNullException("group");
}
if ( interfaceIndex < 0 || interfaceIndex > 0x00FFFFFF ) {
throw new ArgumentOutOfRangeException("interfaceIndex");
}
#if !FEATURE_PAL
if (!ComNetOS.IsPostWin2K){
throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
}
#endif // !FEATURE_PAL
Group = group;
ifIndex = interfaceIndex;
}
///
///
/// Creates a new version of the MulticastOption class for the specified
/// group.
///
///
public MulticastOption(IPAddress group) {
if (group == null) {
throw new ArgumentNullException("group");
}
Group = group;
LocalAddress = IPAddress.Any;
}
///
///
/// Sets the IP address of a multicast group.
///
///
public IPAddress Group {
get {
return group;
}
set {
group = value;
}
}
///
///
/// Sets the local address of a multicast group.
///
///
public IPAddress LocalAddress {
get {
return localAddress;
}
set {
ifIndex = 0;
localAddress = value;
}
}
public int InterfaceIndex {
get {
return ifIndex;
}
set {
if ( value < 0 || value > 0x00FFFFFF ) {
throw new ArgumentOutOfRangeException("value");
}
#if !FEATURE_PAL
if (!ComNetOS.IsPostWin2K){
throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
}
#endif // !FEATURE_PAL
localAddress = null;
ifIndex = value;
}
}
} // class MulticastOption
///
///
/// Contains option values for joining an IPv6 multicast group.
///
///
public class IPv6MulticastOption {
IPAddress m_Group;
long m_Interface;
///
///
/// Creates a new instance of the MulticaseOption class with the specified IP
/// address group and local address.
///
///
public IPv6MulticastOption(IPAddress group, long ifindex) {
if (group == null) {
throw new ArgumentNullException("group");
}
if ( ifindex < 0 || ifindex > 0x00000000FFFFFFFF ) {
throw new ArgumentOutOfRangeException("ifindex");
}
Group = group;
InterfaceIndex = ifindex;
}
///
///
/// Creates a new version of the MulticastOption class for the specified
/// group.
///
///
public IPv6MulticastOption(IPAddress group) {
if (group == null) {
throw new ArgumentNullException("group");
}
Group = group;
InterfaceIndex = 0;
}
///
///
/// Sets the IP address of a multicast group.
///
///
public IPAddress Group {
get {
return m_Group;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
m_Group = value;
}
}
///
///
/// Sets the interface index.
///
///
public long InterfaceIndex {
get {
return m_Interface;
}
set {
if ( value < 0 || value > 0x00000000FFFFFFFF ) {
throw new ArgumentOutOfRangeException("value");
}
m_Interface = value;
}
}
} // class MulticastOptionIPv6
} // namespace System.Net.Sockets
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Sockets {
using System.Net;
///
///
/// Contains option values
/// for IP multicast packets.
///
///
public class MulticastOption {
IPAddress group;
IPAddress localAddress;
int ifIndex;
///
///
/// Creates a new instance of the MulticaseOption class with the specified IP
/// address group and local address.
///
///
public MulticastOption(IPAddress group, IPAddress mcint) {
if (group == null) {
throw new ArgumentNullException("group");
}
if (mcint == null) {
throw new ArgumentNullException("mcint");
}
Group = group;
LocalAddress = mcint;
}
public MulticastOption(IPAddress group, int interfaceIndex) {
if (group == null) {
throw new ArgumentNullException("group");
}
if ( interfaceIndex < 0 || interfaceIndex > 0x00FFFFFF ) {
throw new ArgumentOutOfRangeException("interfaceIndex");
}
#if !FEATURE_PAL
if (!ComNetOS.IsPostWin2K){
throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
}
#endif // !FEATURE_PAL
Group = group;
ifIndex = interfaceIndex;
}
///
///
/// Creates a new version of the MulticastOption class for the specified
/// group.
///
///
public MulticastOption(IPAddress group) {
if (group == null) {
throw new ArgumentNullException("group");
}
Group = group;
LocalAddress = IPAddress.Any;
}
///
///
/// Sets the IP address of a multicast group.
///
///
public IPAddress Group {
get {
return group;
}
set {
group = value;
}
}
///
///
/// Sets the local address of a multicast group.
///
///
public IPAddress LocalAddress {
get {
return localAddress;
}
set {
ifIndex = 0;
localAddress = value;
}
}
public int InterfaceIndex {
get {
return ifIndex;
}
set {
if ( value < 0 || value > 0x00FFFFFF ) {
throw new ArgumentOutOfRangeException("value");
}
#if !FEATURE_PAL
if (!ComNetOS.IsPostWin2K){
throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
}
#endif // !FEATURE_PAL
localAddress = null;
ifIndex = value;
}
}
} // class MulticastOption
///
///
/// Contains option values for joining an IPv6 multicast group.
///
///
public class IPv6MulticastOption {
IPAddress m_Group;
long m_Interface;
///
///
/// Creates a new instance of the MulticaseOption class with the specified IP
/// address group and local address.
///
///
public IPv6MulticastOption(IPAddress group, long ifindex) {
if (group == null) {
throw new ArgumentNullException("group");
}
if ( ifindex < 0 || ifindex > 0x00000000FFFFFFFF ) {
throw new ArgumentOutOfRangeException("ifindex");
}
Group = group;
InterfaceIndex = ifindex;
}
///
///
/// Creates a new version of the MulticastOption class for the specified
/// group.
///
///
public IPv6MulticastOption(IPAddress group) {
if (group == null) {
throw new ArgumentNullException("group");
}
Group = group;
InterfaceIndex = 0;
}
///
///
/// Sets the IP address of a multicast group.
///
///
public IPAddress Group {
get {
return m_Group;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
m_Group = value;
}
}
///
///
/// Sets the interface index.
///
///
public long InterfaceIndex {
get {
return m_Interface;
}
set {
if ( value < 0 || value > 0x00000000FFFFFFFF ) {
throw new ArgumentOutOfRangeException("value");
}
m_Interface = value;
}
}
} // class MulticastOptionIPv6
} // namespace System.Net.Sockets
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlImplementation.cs
- WebControlsSection.cs
- ScriptServiceAttribute.cs
- Misc.cs
- MemoryStream.cs
- Exceptions.cs
- ListBoxAutomationPeer.cs
- AnnouncementSendsAsyncResult.cs
- DockPanel.cs
- FillBehavior.cs
- QuaternionAnimationBase.cs
- FileUpload.cs
- ReflectEventDescriptor.cs
- ClosableStream.cs
- BaseParser.cs
- SharedStatics.cs
- AssemblyCache.cs
- DockProviderWrapper.cs
- DockPatternIdentifiers.cs
- LinkedList.cs
- GlobalizationAssembly.cs
- ExpressionBuilder.cs
- ProfilePropertySettings.cs
- DirectoryObjectSecurity.cs
- DetailsViewModeEventArgs.cs
- ControllableStoryboardAction.cs
- ProviderCommandInfoUtils.cs
- While.cs
- HGlobalSafeHandle.cs
- DataGridCell.cs
- QuaternionRotation3D.cs
- RemotingException.cs
- SrgsGrammar.cs
- TypeContext.cs
- TextTreeRootTextBlock.cs
- ObjectListGeneralPage.cs
- StorageFunctionMapping.cs
- ImagingCache.cs
- WindowsTokenRoleProvider.cs
- ResourceWriter.cs
- ProcessHostMapPath.cs
- CodeTypeConstructor.cs
- SerializationFieldInfo.cs
- HtmlFormParameterWriter.cs
- Int32Animation.cs
- SQLBinaryStorage.cs
- SignatureConfirmationElement.cs
- ClientConfigurationHost.cs
- DataPagerFieldCollection.cs
- UInt64Converter.cs
- WmlPhoneCallAdapter.cs
- RegexTree.cs
- HTMLTagNameToTypeMapper.cs
- CompilerTypeWithParams.cs
- ConditionalBranch.cs
- MouseWheelEventArgs.cs
- RuleRef.cs
- ProfilePropertySettings.cs
- SqlInternalConnection.cs
- Paragraph.cs
- RecognizerStateChangedEventArgs.cs
- ProcessingInstructionAction.cs
- WindowsListViewItemCheckBox.cs
- IisTraceListener.cs
- SequentialWorkflowRootDesigner.cs
- CryptoApi.cs
- ConfigurationManagerHelper.cs
- CacheHelper.cs
- ThrowOnMultipleAssignment.cs
- PackageFilter.cs
- TypeConverterHelper.cs
- IResourceProvider.cs
- SurrogateEncoder.cs
- CompletedAsyncResult.cs
- ConnectionPoolManager.cs
- CanonicalFontFamilyReference.cs
- PeerEndPoint.cs
- FontUnitConverter.cs
- SystemPens.cs
- IOThreadTimer.cs
- KeyGestureValueSerializer.cs
- DuplexChannelBinder.cs
- MultilineStringConverter.cs
- MouseEvent.cs
- ChannelTerminatedException.cs
- xmlfixedPageInfo.cs
- Menu.cs
- PathSegment.cs
- COM2PropertyPageUITypeConverter.cs
- _CommandStream.cs
- SafeNativeMethodsMilCoreApi.cs
- keycontainerpermission.cs
- KnownBoxes.cs
- ExpandSegment.cs
- FrameworkContentElementAutomationPeer.cs
- ToolStripPanel.cs
- TableLayoutSettingsTypeConverter.cs
- QueryableDataSourceEditData.cs
- TypeInfo.cs
- DynamicActivityProperty.cs