Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / NetworkInformation / SystemIPGlobalStatistics.cs / 1305376 / SystemIPGlobalStatistics.cs
///
/// Provides support for ip configuation information and statistics.
///
///
namespace System.Net.NetworkInformation {
using System.Net.Sockets;
using System;
using System.ComponentModel;
///
/// 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.
///
/// Provides support for ip configuation information and statistics.
///
///
namespace System.Net.NetworkInformation {
using System.Net.Sockets;
using System;
using System.ComponentModel;
///
/// 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
- SoapClientProtocol.cs
- DataRecord.cs
- CompositeCollectionView.cs
- ToolBarTray.cs
- ExtendedProperty.cs
- SqlDataSourceRefreshSchemaForm.cs
- MachineKey.cs
- VBIdentifierNameEditor.cs
- DefaultMemberAttribute.cs
- WebColorConverter.cs
- MetadataArtifactLoaderFile.cs
- IndentedTextWriter.cs
- ToolStripRenderer.cs
- ListBox.cs
- Rotation3DKeyFrameCollection.cs
- StringUtil.cs
- Win32NamedPipes.cs
- DriveInfo.cs
- Line.cs
- SmiRecordBuffer.cs
- HyperLink.cs
- TrustManagerMoreInformation.cs
- PnrpPermission.cs
- HybridDictionary.cs
- PreservationFileReader.cs
- AddInServer.cs
- LinkConverter.cs
- CoreSwitches.cs
- Color.cs
- TopClause.cs
- ConstNode.cs
- CharStorage.cs
- GridSplitter.cs
- _NtlmClient.cs
- Composition.cs
- ListViewItemCollectionEditor.cs
- TextEffect.cs
- CodeExporter.cs
- ResourceManager.cs
- SecurityTimestamp.cs
- Request.cs
- ScriptComponentDescriptor.cs
- MaskedTextBoxDesigner.cs
- PartialCachingAttribute.cs
- IItemContainerGenerator.cs
- BindingValueChangedEventArgs.cs
- ServiceDescriptionReflector.cs
- DataListItem.cs
- Transform.cs
- SmiRecordBuffer.cs
- KnownBoxes.cs
- ListBoxChrome.cs
- TargetConverter.cs
- FontCacheUtil.cs
- TextSelectionProcessor.cs
- UnsafeNativeMethodsCLR.cs
- CustomError.cs
- EventData.cs
- CompilerGlobalScopeAttribute.cs
- OdbcErrorCollection.cs
- ACL.cs
- DatePickerTextBox.cs
- HttpHostedTransportConfiguration.cs
- SqlConnection.cs
- _AutoWebProxyScriptEngine.cs
- EntityDataSourceDataSelection.cs
- SQLSingle.cs
- SequenceRange.cs
- HMAC.cs
- SvcMapFile.cs
- XmlHierarchyData.cs
- HasCopySemanticsAttribute.cs
- WebPartTransformer.cs
- SubMenuStyleCollection.cs
- FactoryId.cs
- MouseWheelEventArgs.cs
- UnrecognizedAssertionsBindingElement.cs
- BuildManager.cs
- IisTraceListener.cs
- UpdatePanelControlTrigger.cs
- InvalidAsynchronousStateException.cs
- XmlSchemaAny.cs
- DataBindEngine.cs
- InstanceKeyCollisionException.cs
- QueueProcessor.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- ColorAnimation.cs
- NotSupportedException.cs
- Win32Native.cs
- BinHexDecoder.cs
- HotCommands.cs
- DataObject.cs
- ObjectReferenceStack.cs
- Query.cs
- CreateUserWizard.cs
- relpropertyhelper.cs
- PropertyValueChangedEvent.cs
- MetabaseSettings.cs
- TraceFilter.cs
- OleDbMetaDataFactory.cs