Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / NetworkInformation / SystemIPInterfaceStatistics.cs / 1 / SystemIPInterfaceStatistics.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 SystemIPv4InterfaceStatistics:IPv4InterfaceStatistics { MibIfRow ifRow = new MibIfRow(); private SystemIPv4InterfaceStatistics(){ } internal SystemIPv4InterfaceStatistics(long index){ GetIfEntry(index); } public override long OutputQueueLength{get {return ifRow.dwOutQLen;}} public override long BytesSent{get {return ifRow.dwOutOctets;}} public override long BytesReceived{get {return ifRow.dwInOctets;}} public override long UnicastPacketsSent{get {return ifRow.dwOutUcastPkts;}} public override long UnicastPacketsReceived{get { return ifRow.dwInUcastPkts;}} public override long NonUnicastPacketsSent{get { return ifRow.dwOutNUcastPkts;}} public override long NonUnicastPacketsReceived{get { return ifRow.dwInNUcastPkts;}} public override long IncomingPacketsDiscarded{get { return ifRow.dwInDiscards;}} public override long OutgoingPacketsDiscarded{get { return ifRow.dwOutDiscards;}} public override long IncomingPacketsWithErrors{get { return ifRow.dwInErrors;}} public override long OutgoingPacketsWithErrors{get { return ifRow.dwOutErrors;}} public override long IncomingUnknownProtocolPackets{get { return ifRow.dwInUnknownProtos;}} internal long Mtu{get { return ifRow.dwMtu;}} internal OperationalStatus OperationalStatus{ get{ switch (ifRow.operStatus) { case OldOperationalStatus.NonOperational: return OperationalStatus.Down; case OldOperationalStatus.Unreachable: return OperationalStatus.Down; case OldOperationalStatus.Disconnected: return OperationalStatus.Dormant; case OldOperationalStatus.Connecting: return OperationalStatus.Dormant; case OldOperationalStatus.Connected: return OperationalStatus.Up; case OldOperationalStatus.Operational: return OperationalStatus.Up; } //state unknow return OperationalStatus.Unknown; } } internal long Speed{get { return ifRow.dwSpeed;}} //This method is used to get information for ipv4 specific interfaces //we should only call this the first time one of the properties //are accessed. void GetIfEntry(long index) { if (index == 0 ) return; ifRow.dwIndex = (uint)index; uint result = UnsafeNetInfoNativeMethods.GetIfEntry(ref ifRow); if (result != IpHelperErrors.Success) { throw new NetworkInformationException((int)result); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Literal.cs
- GridPatternIdentifiers.cs
- TextMarkerSource.cs
- BrowserCapabilitiesCompiler.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- ExtendedProtectionPolicyTypeConverter.cs
- XmlDataProvider.cs
- SafeProcessHandle.cs
- ResXResourceSet.cs
- XMLUtil.cs
- SymbolDocumentGenerator.cs
- TextRangeProviderWrapper.cs
- MetadataArtifactLoader.cs
- WebScriptServiceHost.cs
- InstancePersistenceContext.cs
- TriggerAction.cs
- UIElement3D.cs
- GridViewRowEventArgs.cs
- ProjectedSlot.cs
- GlyphRun.cs
- RectangleConverter.cs
- ResXFileRef.cs
- IdentityNotMappedException.cs
- ComplexType.cs
- Queue.cs
- ParallelEnumerable.cs
- AttachedPropertyInfo.cs
- IPAddressCollection.cs
- WindowsStatusBar.cs
- ConfigDefinitionUpdates.cs
- ReverseInheritProperty.cs
- ListBase.cs
- XPathMessageFilterElementComparer.cs
- GeometryValueSerializer.cs
- BitmapEffectInput.cs
- Source.cs
- PageCodeDomTreeGenerator.cs
- ExpressionNormalizer.cs
- XmlMemberMapping.cs
- InputScopeManager.cs
- LinearGradientBrush.cs
- RuleSetBrowserDialog.cs
- TypeViewSchema.cs
- DefaultSettingsSection.cs
- IIS7WorkerRequest.cs
- HostingPreferredMapPath.cs
- ScriptingRoleServiceSection.cs
- Thumb.cs
- XPathDocumentBuilder.cs
- EntitySet.cs
- ContainsSearchOperator.cs
- ByteAnimation.cs
- MapPathBasedVirtualPathProvider.cs
- _AcceptOverlappedAsyncResult.cs
- DataBinder.cs
- DataPagerFieldCommandEventArgs.cs
- XmlUtilWriter.cs
- WebPartDisplayModeCollection.cs
- SelectionWordBreaker.cs
- assemblycache.cs
- HashSet.cs
- PreviewPageInfo.cs
- TaskSchedulerException.cs
- TransactionChannel.cs
- ParallelSeparator.xaml.cs
- HybridObjectCache.cs
- IISMapPath.cs
- SchemaCollectionCompiler.cs
- ProtocolElement.cs
- autovalidator.cs
- GPPOINTF.cs
- ReverseQueryOperator.cs
- MenuCommands.cs
- ServiceProviders.cs
- TrustLevel.cs
- Vector3DCollectionConverter.cs
- SqlAliasesReferenced.cs
- FixedPageStructure.cs
- ListViewUpdateEventArgs.cs
- BrowserCapabilitiesCompiler.cs
- CompleteWizardStep.cs
- DefaultPropertiesToSend.cs
- MultiView.cs
- _FixedSizeReader.cs
- Assembly.cs
- FamilyCollection.cs
- IndexedString.cs
- DataGridViewCellParsingEventArgs.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- SafeFindHandle.cs
- SmiConnection.cs
- PeerTransportListenAddressValidator.cs
- NumericUpDownAcceleration.cs
- HtmlFormWrapper.cs
- EventsTab.cs
- WebBrowserPermission.cs
- WhitespaceRuleLookup.cs
- KnownColorTable.cs
- PropertyIDSet.cs
- ZoneMembershipCondition.cs