Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / NetworkInformation / SystemTcpConnection.cs / 1305376 / SystemTcpConnection.cs
namespace System.Net.NetworkInformation { using System.Net; using System.Net.Sockets; using System.Security.Permissions; using System; using System.Runtime.InteropServices; using System.Collections; using System.ComponentModel; using System.Threading; ////// Represents an active Tcp connection. internal class SystemTcpConnectionInformation:TcpConnectionInformation { IPEndPoint localEndPoint; IPEndPoint remoteEndPoint; TcpState state; internal SystemTcpConnectionInformation(MibTcpRow row) { state = row.state; //port is returned in Big-Endian - most significant bit on left //unfortunately, its done at the word level and not the dword level. int localPort = row.localPort1<<8|row.localPort2; int remotePort = ((state == TcpState.Listen)?0:row.remotePort1<<8|row.remotePort2); localEndPoint = new IPEndPoint(row.localAddr,(int)localPort); remoteEndPoint= new IPEndPoint(row.remoteAddr,(int)remotePort); } // IPV6 version of the Tcp row internal SystemTcpConnectionInformation(MibTcp6RowOwnerPid row) { state = row.state; //port is returned in Big-Endian - most significant bit on left //unfortunately, its done at the word level and not the dword level. int localPort = row.localPort1 << 8 | row.localPort2; int remotePort = ((state == TcpState.Listen) ? 0 : row.remotePort1 << 8 | row.remotePort2); localEndPoint = new IPEndPoint(new IPAddress(row.localAddr, row.localScopeId), (int)localPort); remoteEndPoint = new IPEndPoint(new IPAddress(row.remoteAddr, row.remoteScopeId), (int)remotePort); } public override TcpState State{get {return state;}} public override IPEndPoint LocalEndPoint{get {return localEndPoint;}} public override IPEndPoint RemoteEndPoint{get {return remoteEndPoint;}} } } // 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; using System.Net.Sockets; using System.Security.Permissions; using System; using System.Runtime.InteropServices; using System.Collections; using System.ComponentModel; using System.Threading; ////// Represents an active Tcp connection. internal class SystemTcpConnectionInformation:TcpConnectionInformation { IPEndPoint localEndPoint; IPEndPoint remoteEndPoint; TcpState state; internal SystemTcpConnectionInformation(MibTcpRow row) { state = row.state; //port is returned in Big-Endian - most significant bit on left //unfortunately, its done at the word level and not the dword level. int localPort = row.localPort1<<8|row.localPort2; int remotePort = ((state == TcpState.Listen)?0:row.remotePort1<<8|row.remotePort2); localEndPoint = new IPEndPoint(row.localAddr,(int)localPort); remoteEndPoint= new IPEndPoint(row.remoteAddr,(int)remotePort); } // IPV6 version of the Tcp row internal SystemTcpConnectionInformation(MibTcp6RowOwnerPid row) { state = row.state; //port is returned in Big-Endian - most significant bit on left //unfortunately, its done at the word level and not the dword level. int localPort = row.localPort1 << 8 | row.localPort2; int remotePort = ((state == TcpState.Listen) ? 0 : row.remotePort1 << 8 | row.remotePort2); localEndPoint = new IPEndPoint(new IPAddress(row.localAddr, row.localScopeId), (int)localPort); remoteEndPoint = new IPEndPoint(new IPAddress(row.remoteAddr, row.remoteScopeId), (int)remotePort); } public override TcpState State{get {return state;}} public override IPEndPoint LocalEndPoint{get {return localEndPoint;}} public override IPEndPoint RemoteEndPoint{get {return remoteEndPoint;}} } } // 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
- Point3DAnimation.cs
- BinaryConverter.cs
- CompilerError.cs
- EntityDataSourceWrapperCollection.cs
- XappLauncher.cs
- ZoneLinkButton.cs
- RelatedImageListAttribute.cs
- ZipIOCentralDirectoryBlock.cs
- Model3DGroup.cs
- DataGridViewSelectedCellCollection.cs
- ClientScriptManager.cs
- ModifierKeysConverter.cs
- SafeMILHandle.cs
- EmptyEnumerable.cs
- JsonEnumDataContract.cs
- clipboard.cs
- ASCIIEncoding.cs
- SemanticResultKey.cs
- ScrollItemPattern.cs
- ThaiBuddhistCalendar.cs
- Attachment.cs
- AccessViolationException.cs
- TypeReference.cs
- OLEDB_Enum.cs
- SecurityDocument.cs
- HtmlTableRow.cs
- EmbeddedMailObjectsCollection.cs
- ErrorsHelper.cs
- ManagementObjectCollection.cs
- SoapEnumAttribute.cs
- PartialCachingAttribute.cs
- GridLengthConverter.cs
- TreeNodeStyleCollection.cs
- GeneratedContractType.cs
- Configuration.cs
- UrlUtility.cs
- HtmlFormAdapter.cs
- SoapIgnoreAttribute.cs
- BlurEffect.cs
- XmlIgnoreAttribute.cs
- TypeDescriptionProviderAttribute.cs
- UshortList2.cs
- XmlSerializer.cs
- ServicePointManagerElement.cs
- ToolStripRenderer.cs
- bidPrivateBase.cs
- TextPatternIdentifiers.cs
- HybridDictionary.cs
- ProjectionPruner.cs
- DesignerForm.cs
- EntityCommandDefinition.cs
- CellTreeNode.cs
- OdbcConnectionFactory.cs
- TrustManager.cs
- SmtpNtlmAuthenticationModule.cs
- HttpCachePolicyElement.cs
- DrawingVisual.cs
- InlineObject.cs
- AliasGenerator.cs
- RequestQueue.cs
- DataGridViewUtilities.cs
- CacheMode.cs
- ScopeElementCollection.cs
- SqlProcedureAttribute.cs
- CompositeFontParser.cs
- RemotingConfigParser.cs
- OperationContext.cs
- RequestCache.cs
- WeakReference.cs
- AsymmetricCryptoHandle.cs
- BindStream.cs
- HttpWebRequestElement.cs
- IdentityModelStringsVersion1.cs
- SettingsBindableAttribute.cs
- XmlAttributeAttribute.cs
- MetaTable.cs
- ClientType.cs
- StylusPointProperty.cs
- ImageEditor.cs
- AssemblyNameProxy.cs
- DateTimeOffset.cs
- Add.cs
- VBCodeProvider.cs
- IListConverters.cs
- ProcessHostServerConfig.cs
- SafeArrayTypeMismatchException.cs
- EditorZone.cs
- ImageAutomationPeer.cs
- XmlQualifiedName.cs
- _PooledStream.cs
- JulianCalendar.cs
- HttpProcessUtility.cs
- Registry.cs
- FlowDocumentPage.cs
- WindowsListView.cs
- RuleValidation.cs
- XmlSchemaSimpleContent.cs
- PolyBezierSegmentFigureLogic.cs
- DynamicQueryableWrapper.cs
- SystemIPGlobalStatistics.cs