Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / NetworkInformation / SystemIPGlobalStatistics.cs / 1305376 / 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
- PeerToPeerException.cs
- ThrowHelper.cs
- ParallelRangeManager.cs
- SeekStoryboard.cs
- SafeArrayRankMismatchException.cs
- SigningCredentials.cs
- HashStream.cs
- InitializingNewItemEventArgs.cs
- Variant.cs
- FacetChecker.cs
- RichTextBoxDesigner.cs
- CodeIndexerExpression.cs
- SchemaImporterExtension.cs
- CircleHotSpot.cs
- XComponentModel.cs
- DispatcherObject.cs
- GlobalProxySelection.cs
- DeclarativeCatalogPart.cs
- ObjectParameter.cs
- SystemPens.cs
- RC2CryptoServiceProvider.cs
- DiscoveryOperationContext.cs
- Vector.cs
- BaseValidator.cs
- AppDomainFactory.cs
- ToolStripMenuItem.cs
- NameSpaceExtractor.cs
- ActiveXHost.cs
- PkcsMisc.cs
- ExtensionFile.cs
- ClientApiGenerator.cs
- DataControlFieldCollection.cs
- AlphabetConverter.cs
- CLSCompliantAttribute.cs
- DataSysAttribute.cs
- ScrollProviderWrapper.cs
- StagingAreaInputItem.cs
- SqlAliaser.cs
- AssociationTypeEmitter.cs
- Matrix.cs
- Set.cs
- CompressStream.cs
- BuildManager.cs
- CalendarBlackoutDatesCollection.cs
- DataGridClipboardCellContent.cs
- CqlWriter.cs
- RequestNavigateEventArgs.cs
- GlyphingCache.cs
- StrokeNode.cs
- List.cs
- SQLInt32.cs
- ContextItemManager.cs
- NameValueConfigurationElement.cs
- WebPartManager.cs
- ScrollEventArgs.cs
- ButtonRenderer.cs
- XamlParser.cs
- GB18030Encoding.cs
- AsyncResult.cs
- GridItemPattern.cs
- SerializerDescriptor.cs
- QueryContext.cs
- COM2EnumConverter.cs
- StylusPointPropertyInfoDefaults.cs
- MarshalByRefObject.cs
- DefaultValueTypeConverter.cs
- Condition.cs
- EventLogPermissionHolder.cs
- SortKey.cs
- URLBuilder.cs
- ErrorStyle.cs
- CheckBoxStandardAdapter.cs
- VisualStyleInformation.cs
- EditBehavior.cs
- COM2Enum.cs
- Util.cs
- SqlAggregateChecker.cs
- dataobject.cs
- PageAsyncTaskManager.cs
- BindingExpressionUncommonField.cs
- ControlAdapter.cs
- RegistryDataKey.cs
- ProfileElement.cs
- Win32.cs
- LayoutEvent.cs
- BreakRecordTable.cs
- CallSiteOps.cs
- DropShadowBitmapEffect.cs
- KoreanCalendar.cs
- ElementProxy.cs
- ValidationService.cs
- XamlSerializerUtil.cs
- StrokeIntersection.cs
- AssemblyHash.cs
- SecurityImpersonationBehavior.cs
- CodeSnippetStatement.cs
- ContextQuery.cs
- SplitterEvent.cs
- GenerateTemporaryTargetAssembly.cs
- EntityDataSource.cs