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
- XPathScanner.cs
- NativeCompoundFileAPIs.cs
- SessionStateSection.cs
- SuppressMessageAttribute.cs
- WinFormsSpinner.cs
- PropertySourceInfo.cs
- MetadataArtifactLoader.cs
- MatrixIndependentAnimationStorage.cs
- RegexCode.cs
- DataGridViewColumnCollectionEditor.cs
- MimeReflector.cs
- Visual.cs
- BulletChrome.cs
- ConfigurationSectionGroup.cs
- EndpointAddressMessageFilter.cs
- BaseDataList.cs
- SingleConverter.cs
- SemanticAnalyzer.cs
- ReferenceConverter.cs
- TrustExchangeException.cs
- CreateUserWizardStep.cs
- DoubleStorage.cs
- RefExpr.cs
- Thickness.cs
- MetabaseServerConfig.cs
- ValidationError.cs
- SQLInt16Storage.cs
- DataTableExtensions.cs
- WebConfigurationFileMap.cs
- ToolStrip.cs
- HttpApplicationFactory.cs
- Base64Decoder.cs
- SqlHelper.cs
- LabelLiteral.cs
- DbUpdateCommandTree.cs
- XmlRootAttribute.cs
- XmlWrappingWriter.cs
- TransformDescriptor.cs
- WsatServiceCertificate.cs
- HtmlContainerControl.cs
- ResourcePool.cs
- PenThread.cs
- _NegoStream.cs
- ListenUriMode.cs
- StreamGeometry.cs
- HashHelper.cs
- MetadataArtifactLoaderComposite.cs
- XmlSignatureProperties.cs
- DataTableCollection.cs
- TextElementEnumerator.cs
- SiteMapNodeItem.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- TokenBasedSetEnumerator.cs
- WebResourceAttribute.cs
- SqlTypeConverter.cs
- ExtractedStateEntry.cs
- TableStyle.cs
- AtlasWeb.Designer.cs
- Command.cs
- AddressHeader.cs
- PropertyMapper.cs
- WebDescriptionAttribute.cs
- SplineQuaternionKeyFrame.cs
- HtmlInputReset.cs
- EmptyCollection.cs
- ScriptServiceAttribute.cs
- XPathMessageFilterElement.cs
- ActivationServices.cs
- VirtualizedItemPattern.cs
- JsonFormatGeneratorStatics.cs
- ProvidersHelper.cs
- PrimitiveCodeDomSerializer.cs
- Debugger.cs
- DataComponentNameHandler.cs
- SelectionItemPattern.cs
- TextOnlyOutput.cs
- Command.cs
- DocumentPageTextView.cs
- OpCodes.cs
- MessageBox.cs
- MappingMetadataHelper.cs
- Opcode.cs
- HtmlTitle.cs
- XmlSchemaDatatype.cs
- TransformationRules.cs
- HttpRequest.cs
- Configuration.cs
- OrderedDictionary.cs
- Rotation3DAnimationBase.cs
- ToolStripStatusLabel.cs
- PageClientProxyGenerator.cs
- XhtmlBasicObjectListAdapter.cs
- LocationUpdates.cs
- XmlElementElement.cs
- WebPartVerbCollection.cs
- AliasExpr.cs
- DataServiceExpressionVisitor.cs
- ellipse.cs
- PropertyPathConverter.cs
- GenericTransactionFlowAttribute.cs