Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ParallelEnumerable.cs
- WeakReferenceList.cs
- PerspectiveCamera.cs
- SystemIPv4InterfaceProperties.cs
- DocumentSequence.cs
- ProvidersHelper.cs
- Function.cs
- peernodestatemanager.cs
- CustomAttributeFormatException.cs
- ComponentRenameEvent.cs
- EnumerableWrapperWeakToStrong.cs
- XmlWellformedWriterHelpers.cs
- XmlFormatReaderGenerator.cs
- XamlBrushSerializer.cs
- MonitorWrapper.cs
- TemplateControlParser.cs
- Span.cs
- ConfigXmlSignificantWhitespace.cs
- EntityDataSourceQueryBuilder.cs
- BaseInfoTable.cs
- XmlSchemaAny.cs
- CompoundFileReference.cs
- AndCondition.cs
- SerializationObjectManager.cs
- RuntimeUtils.cs
- RenameRuleObjectDialog.Designer.cs
- MethodBody.cs
- IntSecurity.cs
- DataGridViewSelectedRowCollection.cs
- URLMembershipCondition.cs
- DecoratedNameAttribute.cs
- ServiceHostingEnvironment.cs
- Menu.cs
- ToolStripItemTextRenderEventArgs.cs
- BinaryWriter.cs
- ConfigsHelper.cs
- ResolveDuplexAsyncResult.cs
- DelayDesigner.cs
- BevelBitmapEffect.cs
- Line.cs
- MetadataItemSerializer.cs
- ObjectSet.cs
- PageWrapper.cs
- HuffmanTree.cs
- X509Utils.cs
- HashCodeCombiner.cs
- AccessControlEntry.cs
- PropertyDescriptor.cs
- NetDataContractSerializer.cs
- SqlWebEventProvider.cs
- SafeRightsManagementHandle.cs
- DocumentOrderQuery.cs
- UnknownWrapper.cs
- UserControl.cs
- activationcontext.cs
- StdValidatorsAndConverters.cs
- Vector3DCollectionConverter.cs
- SettingsPropertyNotFoundException.cs
- DockingAttribute.cs
- ClientBuildManagerCallback.cs
- HWStack.cs
- StylusPointProperties.cs
- LookupNode.cs
- AnnotationMap.cs
- XmlAtomicValue.cs
- CutCopyPasteHelper.cs
- FieldDescriptor.cs
- ReachPageContentCollectionSerializerAsync.cs
- ApplicationInfo.cs
- Accessible.cs
- SmiRecordBuffer.cs
- PropertyEmitterBase.cs
- DesignerActionItemCollection.cs
- PropertyGrid.cs
- InputProcessorProfilesLoader.cs
- TdsParserStateObject.cs
- Part.cs
- SqlWorkflowPersistenceService.cs
- RightsManagementEncryptedStream.cs
- RouteParametersHelper.cs
- ElementHost.cs
- serverconfig.cs
- ChildrenQuery.cs
- TableLayoutColumnStyleCollection.cs
- Convert.cs
- XamlLoadErrorInfo.cs
- Matrix3D.cs
- CodeRemoveEventStatement.cs
- ViewPort3D.cs
- DispatcherHooks.cs
- XmlComment.cs
- DataIdProcessor.cs
- EntityDataSourceChangingEventArgs.cs
- DateTimeFormat.cs
- ConnectorDragDropGlyph.cs
- ThicknessAnimationBase.cs
- SecurityDescriptor.cs
- login.cs
- SmtpReplyReader.cs
- UiaCoreProviderApi.cs