Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / UdpAnnouncementEndpoint.cs / 1305376 / UdpAnnouncementEndpoint.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.ServiceModel.Discovery
{
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Channels;
[Fx.Tag.XamlVisible(false)]
public class UdpAnnouncementEndpoint : AnnouncementEndpoint
{
[SuppressMessage(FxCop.Category.Security, FxCop.Rule.DoNotDeclareReadOnlyMutableReferenceTypes)]
[SuppressMessage(FxCop.Category.Naming, "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Pv", Justification = "IPv4 is valid.")]
public static readonly Uri DefaultIPv4MulticastAddress = DiscoveryDefaults.Udp.IPv4MulticastAddress;
[SuppressMessage(FxCop.Category.Security, FxCop.Rule.DoNotDeclareReadOnlyMutableReferenceTypes)]
[SuppressMessage(FxCop.Category.Naming, "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Pv", Justification = "IPv6 is valid.")]
public static readonly Uri DefaultIPv6MulticastAddress = DiscoveryDefaults.Udp.IPv6MulticastAddress;
DiscoveryViaBehavior viaBehavior;
UdpTransportSettings udpTransportSettings;
public UdpAnnouncementEndpoint()
: this(DefaultIPv4MulticastAddress)
{
}
public UdpAnnouncementEndpoint(string multicastAddress)
: this(new Uri(multicastAddress))
{
}
public UdpAnnouncementEndpoint(Uri multicastAddress)
: this(DiscoveryVersion.DefaultDiscoveryVersion, multicastAddress)
{
}
public UdpAnnouncementEndpoint(DiscoveryVersion discoveryVersion)
: this(discoveryVersion, DefaultIPv4MulticastAddress)
{
}
public UdpAnnouncementEndpoint(DiscoveryVersion discoveryVersion, string multicastAddress)
: this(discoveryVersion, new Uri(multicastAddress))
{
}
public UdpAnnouncementEndpoint(DiscoveryVersion discoveryVersion, Uri multicastAddress)
: base(discoveryVersion)
{
if (multicastAddress == null)
{
throw FxTrace.Exception.ArgumentNull("multicastAddress");
}
if (discoveryVersion == null)
{
throw FxTrace.Exception.ArgumentNull("discoveryVersion");
}
Initialize(multicastAddress);
}
public Uri MulticastAddress
{
get
{
return this.viaBehavior.Via;
}
set
{
if (value == null)
{
throw FxTrace.Exception.ArgumentNull("value");
}
this.viaBehavior.Via = value;
base.ListenUri = value;
}
}
public UdpTransportSettings TransportSettings
{
get
{
return this.udpTransportSettings;
}
}
void Initialize(Uri multicastAddress)
{
this.viaBehavior = new DiscoveryViaBehavior(multicastAddress);
base.ListenUri = multicastAddress;
TextMessageEncodingBindingElement textBE = new TextMessageEncodingBindingElement();
textBE.MessageVersion = base.DiscoveryVersion.Implementation.MessageVersion;
UdpTransportBindingElement udpBE = DiscoveryDefaults.Udp.CreateUdpTransportBindingElement();
this.udpTransportSettings = new UdpTransportSettings(udpBE);
CustomBinding binding = new CustomBinding();
binding.Elements.Add(textBE);
binding.Elements.Add(udpBE);
base.MaxAnnouncementDelay = DiscoveryDefaults.Udp.AppMaxDelay;
base.Address = new EndpointAddress(base.DiscoveryVersion.Implementation.DiscoveryAddress);
base.Binding = binding;
base.Behaviors.Add(this.viaBehavior);
base.Behaviors.Add(new UdpContractFilterBehavior());
}
}
}
// 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
- BrowserCapabilitiesCompiler.cs
- EffectiveValueEntry.cs
- TimerEventSubscription.cs
- TaskForm.cs
- WeakReferenceList.cs
- RemoteWebConfigurationHostStream.cs
- MergeLocalizationDirectives.cs
- MachineKeyConverter.cs
- DataGridViewLinkCell.cs
- HMACRIPEMD160.cs
- StackOverflowException.cs
- TemplatePagerField.cs
- ExceptionTranslationTable.cs
- StateRuntime.cs
- SqlRowUpdatedEvent.cs
- SoapIncludeAttribute.cs
- PasswordBoxAutomationPeer.cs
- PeerValidationBehavior.cs
- BitmapCodecInfo.cs
- ExpandCollapsePattern.cs
- MonthChangedEventArgs.cs
- BitmapData.cs
- ExpressionWriter.cs
- XamlPointCollectionSerializer.cs
- PolicyValidationException.cs
- NullRuntimeConfig.cs
- HtmlWindowCollection.cs
- RuleSet.cs
- SmtpFailedRecipientException.cs
- FixedTextView.cs
- TextDecorationCollectionConverter.cs
- WorkflowServiceAttributes.cs
- CellIdBoolean.cs
- PropertyValue.cs
- SecurityTokenTypes.cs
- TripleDESCryptoServiceProvider.cs
- SynchronizingStream.cs
- BitmapEncoder.cs
- _ConnectOverlappedAsyncResult.cs
- XamlPointCollectionSerializer.cs
- DesignerForm.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- EventMappingSettingsCollection.cs
- TreeViewImageIndexConverter.cs
- OracleParameter.cs
- SqlWebEventProvider.cs
- Mapping.cs
- Parallel.cs
- GradientBrush.cs
- ArraySet.cs
- FormsAuthenticationUser.cs
- SelectionRangeConverter.cs
- CorePropertiesFilter.cs
- InfoCardTraceRecord.cs
- Border.cs
- ObjectViewEntityCollectionData.cs
- PriorityBindingExpression.cs
- XmlHelper.cs
- SortedList.cs
- Unit.cs
- ServiceReflector.cs
- PbrsForward.cs
- NamespaceDisplay.xaml.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- WarningException.cs
- StringValueSerializer.cs
- SqlExpander.cs
- PropertyTab.cs
- GeneratedContractType.cs
- PropertyDescriptorComparer.cs
- AudioFormatConverter.cs
- XmlDictionaryWriter.cs
- UnknownWrapper.cs
- AutoCompleteStringCollection.cs
- SqlAggregateChecker.cs
- XslTransform.cs
- HtmlInputFile.cs
- _NtlmClient.cs
- PerformanceCounterManager.cs
- ZeroOpNode.cs
- DataBinding.cs
- ViewGenResults.cs
- Subset.cs
- PreProcessor.cs
- WindowManager.cs
- Trigger.cs
- MessageHeaderDescription.cs
- GridViewDeleteEventArgs.cs
- TypeForwardedToAttribute.cs
- WebPartConnectionsConnectVerb.cs
- SecurityManager.cs
- RelatedEnd.cs
- PackageFilter.cs
- ViewLoader.cs
- VectorAnimation.cs
- DetailsViewInsertedEventArgs.cs
- SelectedGridItemChangedEvent.cs
- ImageResources.Designer.cs
- WasAdminWrapper.cs
- Rfc2898DeriveBytes.cs