Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / UdpDiscoveryEndpoint.cs / 1305376 / UdpDiscoveryEndpoint.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 UdpDiscoveryEndpoint : DiscoveryEndpoint { [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 UdpDiscoveryEndpoint() : this(DefaultIPv4MulticastAddress) { } public UdpDiscoveryEndpoint(string multicastAddress) : this(new Uri(multicastAddress)) { } public UdpDiscoveryEndpoint(Uri multicastAddress) : this(DiscoveryVersion.DefaultDiscoveryVersion, multicastAddress) { } public UdpDiscoveryEndpoint(DiscoveryVersion discoveryVersion) : this(discoveryVersion, DefaultIPv4MulticastAddress) { } public UdpDiscoveryEndpoint(DiscoveryVersion discoveryVersion, string multicastAddress) : this(discoveryVersion, new Uri(multicastAddress)) { } public UdpDiscoveryEndpoint(DiscoveryVersion discoveryVersion, Uri multicastAddress) : base(discoveryVersion, ServiceDiscoveryMode.Adhoc) { 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.MaxResponseDelay = DiscoveryDefaults.Udp.AppMaxDelay; base.Address = new EndpointAddress(base.DiscoveryVersion.Implementation.DiscoveryAddress); base.Binding = binding; base.Behaviors.Add(this.viaBehavior); base.Behaviors.Add(new UdpReplyToBehavior(udpBE.Scheme)); 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
- ReaderWriterLock.cs
- BaseCodeDomTreeGenerator.cs
- EncodingNLS.cs
- ProviderConnectionPointCollection.cs
- PersianCalendar.cs
- TextClipboardData.cs
- TimeEnumHelper.cs
- DataListItemEventArgs.cs
- StickyNoteHelper.cs
- TemplateNodeContextMenu.cs
- FrameworkPropertyMetadata.cs
- GestureRecognitionResult.cs
- EditableRegion.cs
- HtmlInputText.cs
- ScriptComponentDescriptor.cs
- GregorianCalendar.cs
- IntPtr.cs
- X509UI.cs
- XmlTypeMapping.cs
- EncoderReplacementFallback.cs
- TextBox.cs
- Literal.cs
- SchemaLookupTable.cs
- CatalogZoneDesigner.cs
- SetterBase.cs
- SqlTrackingService.cs
- ThrowHelper.cs
- Size.cs
- DecimalMinMaxAggregationOperator.cs
- ListManagerBindingsCollection.cs
- VectorValueSerializer.cs
- Stacktrace.cs
- CharacterShapingProperties.cs
- Listbox.cs
- ConnectionInterfaceCollection.cs
- InsufficientMemoryException.cs
- ProviderConnectionPointCollection.cs
- WorkflowDebuggerSteppingAttribute.cs
- TraceLevelStore.cs
- SqlExpander.cs
- JoinSymbol.cs
- SqlVisitor.cs
- ConsoleTraceListener.cs
- FlowDocumentReader.cs
- ReceiveContextCollection.cs
- ElementMarkupObject.cs
- SettingsPropertyValueCollection.cs
- WorkflowInlining.cs
- FrameworkContextData.cs
- StringSource.cs
- DataTableReaderListener.cs
- ReaderOutput.cs
- TransportDefaults.cs
- CompiledWorkflowDefinitionContext.cs
- AttachmentCollection.cs
- DescendantBaseQuery.cs
- SubqueryRules.cs
- TableCellCollection.cs
- StyleXamlParser.cs
- ProcessHostConfigUtils.cs
- ControlBindingsConverter.cs
- Stack.cs
- ListBindableAttribute.cs
- DesignerFrame.cs
- MetabaseServerConfig.cs
- WindowsProgressbar.cs
- TreePrinter.cs
- RootBrowserWindowProxy.cs
- HttpRuntimeSection.cs
- DBBindings.cs
- OutputBuffer.cs
- Command.cs
- EmptyEnumerable.cs
- FilteredDataSetHelper.cs
- CaseInsensitiveHashCodeProvider.cs
- SqlRowUpdatingEvent.cs
- LinqDataSourceUpdateEventArgs.cs
- HierarchicalDataSourceControl.cs
- SmiXetterAccessMap.cs
- ScriptRegistrationManager.cs
- Boolean.cs
- MarkupCompiler.cs
- Missing.cs
- WmlValidationSummaryAdapter.cs
- MouseButton.cs
- EarlyBoundInfo.cs
- PasswordBoxAutomationPeer.cs
- HttpAsyncResult.cs
- TableCellsCollectionEditor.cs
- DescendantBaseQuery.cs
- TypeDescriptor.cs
- WebServicesInteroperability.cs
- SequentialUshortCollection.cs
- XmlReflectionMember.cs
- InternalPermissions.cs
- IIS7WorkerRequest.cs
- TrackingSection.cs
- DependencyProperty.cs
- CorrelationValidator.cs
- PartBasedPackageProperties.cs