Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / NetworkInformation / SystemIPGlobalStatistics.cs / 1 / SystemIPGlobalStatistics.cs
////// namespace System.Net.NetworkInformation { using System.Net.Sockets; using System; using System.ComponentModel; /// /// Provides support for ip configuation information and statistics. /// /// IP statistics internal class SystemIPGlobalStatistics:IPGlobalStatistics { MibIpStats stats = new MibIpStats(); private SystemIPGlobalStatistics(){ } internal SystemIPGlobalStatistics(AddressFamily family){ uint result; if (!ComNetOS.IsPostWin2K){ if (family!= AddressFamily.InterNetwork){ throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired)); } result = UnsafeNetInfoNativeMethods.GetIpStatistics(out stats); } else result = UnsafeNetInfoNativeMethods.GetIpStatisticsEx(out stats, family); if (result != IpHelperErrors.Success) { throw new NetworkInformationException((int)result); } } ///public override bool ForwardingEnabled{get {return stats.forwardingEnabled;}} /// public override int DefaultTtl{get {return (int) stats.defaultTtl;}} /// public override long ReceivedPackets{get {return stats.packetsReceived;}} /// public override long ReceivedPacketsWithHeadersErrors{get {return stats.receivedPacketsWithHeaderErrors;}} /// public override long ReceivedPacketsWithAddressErrors{get {return stats.receivedPacketsWithAddressErrors;}} /// public override long ReceivedPacketsForwarded{get {return stats.packetsForwarded;}} /// public override long ReceivedPacketsWithUnknownProtocol{get {return stats.receivedPacketsWithUnknownProtocols;}} /// public override long ReceivedPacketsDiscarded{get {return stats.receivedPacketsDiscarded;}} /// public override long ReceivedPacketsDelivered{get {return stats.receivedPacketsDelivered;}} /// public override long OutputPacketRequests{get {return stats.packetOutputRequests;}} /// public override long OutputPacketRoutingDiscards{get {return stats.outputPacketRoutingDiscards;}} /// public override long OutputPacketsDiscarded{get {return stats.outputPacketsDiscarded;}} /// public override long OutputPacketsWithNoRoute{get {return stats.outputPacketsWithNoRoute;}} /// public override long PacketReassemblyTimeout{get {return stats.packetReassemblyTimeout;}} /// public override long PacketReassembliesRequired{get {return stats.packetsReassemblyRequired;}} /// public override long PacketsReassembled{get {return stats.packetsReassembled;}} /// public override long PacketReassemblyFailures{get {return stats.packetsReassemblyFailed;}} /// public override long PacketsFragmented{get {return stats.packetsFragmented;}} /// public override long PacketFragmentFailures{get {return stats.packetsFragmentFailed;}} /// public override int NumberOfInterfaces{get {return (int)stats.interfaces;}} /// public override int NumberOfIPAddresses{get {return (int)stats.ipAddresses;}} /// public override int NumberOfRoutes{get {return (int)stats.routes;}} } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /// /// namespace System.Net.NetworkInformation { using System.Net.Sockets; using System; using System.ComponentModel; /// /// Provides support for ip configuation information and statistics. /// /// IP statistics internal class SystemIPGlobalStatistics:IPGlobalStatistics { MibIpStats stats = new MibIpStats(); private SystemIPGlobalStatistics(){ } internal SystemIPGlobalStatistics(AddressFamily family){ uint result; if (!ComNetOS.IsPostWin2K){ if (family!= AddressFamily.InterNetwork){ throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired)); } result = UnsafeNetInfoNativeMethods.GetIpStatistics(out stats); } else result = UnsafeNetInfoNativeMethods.GetIpStatisticsEx(out stats, family); if (result != IpHelperErrors.Success) { throw new NetworkInformationException((int)result); } } ///public override bool ForwardingEnabled{get {return stats.forwardingEnabled;}} /// public override int DefaultTtl{get {return (int) stats.defaultTtl;}} /// public override long ReceivedPackets{get {return stats.packetsReceived;}} /// public override long ReceivedPacketsWithHeadersErrors{get {return stats.receivedPacketsWithHeaderErrors;}} /// public override long ReceivedPacketsWithAddressErrors{get {return stats.receivedPacketsWithAddressErrors;}} /// public override long ReceivedPacketsForwarded{get {return stats.packetsForwarded;}} /// public override long ReceivedPacketsWithUnknownProtocol{get {return stats.receivedPacketsWithUnknownProtocols;}} /// public override long ReceivedPacketsDiscarded{get {return stats.receivedPacketsDiscarded;}} /// public override long ReceivedPacketsDelivered{get {return stats.receivedPacketsDelivered;}} /// public override long OutputPacketRequests{get {return stats.packetOutputRequests;}} /// public override long OutputPacketRoutingDiscards{get {return stats.outputPacketRoutingDiscards;}} /// public override long OutputPacketsDiscarded{get {return stats.outputPacketsDiscarded;}} /// public override long OutputPacketsWithNoRoute{get {return stats.outputPacketsWithNoRoute;}} /// public override long PacketReassemblyTimeout{get {return stats.packetReassemblyTimeout;}} /// public override long PacketReassembliesRequired{get {return stats.packetsReassemblyRequired;}} /// public override long PacketsReassembled{get {return stats.packetsReassembled;}} /// public override long PacketReassemblyFailures{get {return stats.packetsReassemblyFailed;}} /// public override long PacketsFragmented{get {return stats.packetsFragmented;}} /// public override long PacketFragmentFailures{get {return stats.packetsFragmentFailed;}} /// public override int NumberOfInterfaces{get {return (int)stats.interfaces;}} /// public override int NumberOfIPAddresses{get {return (int)stats.ipAddresses;}} /// public override int NumberOfRoutes{get {return (int)stats.routes;}} } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FlowDocumentScrollViewerAutomationPeer.cs
- BindingListCollectionView.cs
- DefaultEventAttribute.cs
- PictureBoxDesigner.cs
- QuotedPrintableStream.cs
- XmlSchemaSimpleContentExtension.cs
- NameObjectCollectionBase.cs
- TiffBitmapEncoder.cs
- DataObjectSettingDataEventArgs.cs
- SystemTcpStatistics.cs
- ListViewGroupItemCollection.cs
- ExtendedPropertyDescriptor.cs
- _Semaphore.cs
- PropertyFilterAttribute.cs
- BatchStream.cs
- RewritingPass.cs
- DataGridViewTextBoxCell.cs
- BinaryUtilClasses.cs
- SimpleBitVector32.cs
- XamlClipboardData.cs
- DependencyObjectProvider.cs
- ImageMap.cs
- Misc.cs
- DateBoldEvent.cs
- QualificationDataAttribute.cs
- ByteStream.cs
- KeyMatchBuilder.cs
- HtmlFormWrapper.cs
- Authorization.cs
- VisualTarget.cs
- __TransparentProxy.cs
- CssTextWriter.cs
- BodyWriter.cs
- DataListComponentEditor.cs
- IntSecurity.cs
- EntryIndex.cs
- MultipleViewProviderWrapper.cs
- SQLMoney.cs
- SafeRegistryKey.cs
- HostSecurityManager.cs
- FactoryRecord.cs
- AudioFormatConverter.cs
- CompiledRegexRunner.cs
- CounterCreationDataCollection.cs
- Stacktrace.cs
- HtmlLink.cs
- DataGridViewComboBoxColumn.cs
- ImportOptions.cs
- GrammarBuilderRuleRef.cs
- PropertyGroupDescription.cs
- OleStrCAMarshaler.cs
- IpcClientManager.cs
- ToolboxSnapDragDropEventArgs.cs
- TableLayoutPanelBehavior.cs
- AuthorizationRuleCollection.cs
- IntersectQueryOperator.cs
- ItemsControl.cs
- Int32AnimationBase.cs
- DoubleAnimationUsingPath.cs
- Crypto.cs
- TextBreakpoint.cs
- StickyNote.cs
- TableProvider.cs
- DataSourceControl.cs
- MsmqActivation.cs
- SafeNativeMethods.cs
- NameSpaceExtractor.cs
- Brushes.cs
- ScriptingJsonSerializationSection.cs
- StorageEntityContainerMapping.cs
- QilName.cs
- ServiceAppDomainAssociationProvider.cs
- SecurityChannelFactory.cs
- NewArrayExpression.cs
- DesignerCapabilities.cs
- BypassElementCollection.cs
- DesignerActionMethodItem.cs
- MouseGestureConverter.cs
- BamlTreeMap.cs
- Brushes.cs
- WorkflowQueueInfo.cs
- EdmMember.cs
- ETagAttribute.cs
- SqlWriter.cs
- HeaderedItemsControl.cs
- ClientTargetCollection.cs
- AbsoluteQuery.cs
- SharedPerformanceCounter.cs
- ReaderWriterLockWrapper.cs
- TextServicesProperty.cs
- DataServiceOperationContext.cs
- ConfigXmlElement.cs
- ValueQuery.cs
- MobileCapabilities.cs
- SiteMapHierarchicalDataSourceView.cs
- SignedXmlDebugLog.cs
- TextTabProperties.cs
- XmlCharType.cs
- DataRelation.cs
- AssemblyFilter.cs