Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameSecurityDescriptor.cs
- SingletonInstanceContextProvider.cs
- OleServicesContext.cs
- PassportPrincipal.cs
- FlowDecision.cs
- HostingEnvironmentException.cs
- PropertyEmitterBase.cs
- ScriptingJsonSerializationSection.cs
- WebPartHeaderCloseVerb.cs
- ResourcePart.cs
- WebCategoryAttribute.cs
- TraceContext.cs
- ParentControlDesigner.cs
- InputLanguage.cs
- CodeAttributeArgumentCollection.cs
- ValidationEventArgs.cs
- OdbcError.cs
- CryptographicAttribute.cs
- JumpList.cs
- QuaternionRotation3D.cs
- ProfileModule.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- MetadataArtifactLoaderComposite.cs
- MdiWindowListStrip.cs
- OletxDependentTransaction.cs
- ChoiceConverter.cs
- Executor.cs
- DataBindingHandlerAttribute.cs
- DataTableMapping.cs
- NameScope.cs
- ToolStripSplitStackLayout.cs
- SoundPlayerAction.cs
- Mappings.cs
- BindingRestrictions.cs
- _LazyAsyncResult.cs
- EventArgs.cs
- latinshape.cs
- ReferentialConstraint.cs
- Statements.cs
- MouseWheelEventArgs.cs
- Rectangle.cs
- Profiler.cs
- httpstaticobjectscollection.cs
- SqlDataSourceStatusEventArgs.cs
- CodeNamespaceImportCollection.cs
- DataGridAutoFormatDialog.cs
- BaseParaClient.cs
- DefaultTraceListener.cs
- SecurityImpersonationBehavior.cs
- RectangleConverter.cs
- ExpressionBuilderContext.cs
- CurrencyWrapper.cs
- UITypeEditor.cs
- RemoveStoryboard.cs
- ParameterElementCollection.cs
- SafeViewOfFileHandle.cs
- safesecurityhelperavalon.cs
- Comparer.cs
- Int16.cs
- ComplexTypeEmitter.cs
- CacheHelper.cs
- XmlChildEnumerator.cs
- SettingsPropertyValue.cs
- cookiecontainer.cs
- TranslateTransform.cs
- NetStream.cs
- AttachedPropertyMethodSelector.cs
- TextServicesContext.cs
- NumberFunctions.cs
- BindUriHelper.cs
- FormViewUpdatedEventArgs.cs
- CacheChildrenQuery.cs
- ConstructorArgumentAttribute.cs
- SessionKeyExpiredException.cs
- PhysicalFontFamily.cs
- Part.cs
- ActivityMarkupSerializationProvider.cs
- ConfigurationValue.cs
- MouseGesture.cs
- Mapping.cs
- SelectionHighlightInfo.cs
- GridViewHeaderRowPresenter.cs
- XmlSerializationGeneratedCode.cs
- localization.cs
- ElementNotEnabledException.cs
- Border.cs
- cryptoapiTransform.cs
- StringToken.cs
- ModelMemberCollection.cs
- PathFigure.cs
- ProxyHwnd.cs
- CompilationUnit.cs
- NullableConverter.cs
- CodeCatchClauseCollection.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ConnectionPoolManager.cs
- SamlSecurityToken.cs
- PenContext.cs
- SettingsProviderCollection.cs
- DesignerUtils.cs