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
- GridViewRowEventArgs.cs
- StringUtil.cs
- InfoCard.cs
- ToolConsole.cs
- Int16AnimationBase.cs
- PropertyConverter.cs
- DateTimeStorage.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- BaseTemplateParser.cs
- HtmlControlAdapter.cs
- Dump.cs
- WebPartDisplayMode.cs
- EmptyStringExpandableObjectConverter.cs
- Socket.cs
- loginstatus.cs
- SeverityFilter.cs
- FileInfo.cs
- XmlSubtreeReader.cs
- TriggerCollection.cs
- DispatcherExceptionFilterEventArgs.cs
- CompositeScriptReferenceEventArgs.cs
- MinimizableAttributeTypeConverter.cs
- NavigatorInput.cs
- SqlTypeSystemProvider.cs
- Misc.cs
- SEHException.cs
- Adorner.cs
- ThreadNeutralSemaphore.cs
- VariantWrapper.cs
- RequestDescription.cs
- RealizationDrawingContextWalker.cs
- ReturnEventArgs.cs
- basevalidator.cs
- ActivityUtilities.cs
- GridEntryCollection.cs
- ProjectionPathBuilder.cs
- EnlistmentState.cs
- ComponentResourceKey.cs
- StorageEntityTypeMapping.cs
- ImageCodecInfoPrivate.cs
- OdbcConnection.cs
- SocketException.cs
- DelegateOutArgument.cs
- MatrixUtil.cs
- TouchesCapturedWithinProperty.cs
- TextEffect.cs
- SHA1CryptoServiceProvider.cs
- DataGridViewColumnCollectionEditor.cs
- IISMapPath.cs
- DataGridViewTextBoxColumn.cs
- HtmlUtf8RawTextWriter.cs
- BitmapEffectInput.cs
- QuinticEase.cs
- InvalidEnumArgumentException.cs
- SystemIPAddressInformation.cs
- DependencyPropertyChangedEventArgs.cs
- MetadataPropertyAttribute.cs
- ContractSearchPattern.cs
- Pkcs9Attribute.cs
- HostDesigntimeLicenseContext.cs
- EllipseGeometry.cs
- XmlRawWriterWrapper.cs
- CompilerCollection.cs
- EntityModelBuildProvider.cs
- BuildProvider.cs
- TouchesOverProperty.cs
- RightNameExpirationInfoPair.cs
- IisTraceWebEventProvider.cs
- GridViewDeletedEventArgs.cs
- CharKeyFrameCollection.cs
- Dispatcher.cs
- Wizard.cs
- VBIdentifierDesigner.xaml.cs
- ItemPager.cs
- XmlDocumentFragment.cs
- PrintControllerWithStatusDialog.cs
- DesignerEditorPartChrome.cs
- Pointer.cs
- _UriSyntax.cs
- HScrollBar.cs
- WorkflowInstanceAbortedRecord.cs
- RefreshEventArgs.cs
- WorkflowWebHostingModule.cs
- TypeUtils.cs
- DataSet.cs
- Decorator.cs
- DictationGrammar.cs
- DataGridViewComboBoxColumn.cs
- AnonymousIdentificationModule.cs
- TCPClient.cs
- baseshape.cs
- BaseParagraph.cs
- SystemException.cs
- Trace.cs
- FileDialog.cs
- SoapInteropTypes.cs
- Currency.cs
- Parser.cs
- UpdateRecord.cs
- mansign.cs