Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Net / System / Net / NetworkInformation / SystemTcpConnection.cs / 1 / 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.localPort3<<24|row.localPort4<<16|row.localPort1<<8|row.localPort2; int remotePort = ((state == TcpState.Listen)?0:row.remotePort3<<24|row.remotePort4<<16|row.remotePort1<<8|row.remotePort2); //need to fix these. Currently they ---- up if high order bit is set. // uint localPort = (uint)IPAddress.HostToNetworkOrder((short)row.localPort1); // uint remotePort = (uint)IPAddress.HostToNetworkOrder((short)row.remotePort1); localEndPoint = new IPEndPoint(row.localAddr,(int)localPort); remoteEndPoint= new IPEndPoint(row.remoteAddr,(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.localPort3<<24|row.localPort4<<16|row.localPort1<<8|row.localPort2; int remotePort = ((state == TcpState.Listen)?0:row.remotePort3<<24|row.remotePort4<<16|row.remotePort1<<8|row.remotePort2); //need to fix these. Currently they ---- up if high order bit is set. // uint localPort = (uint)IPAddress.HostToNetworkOrder((short)row.localPort1); // uint remotePort = (uint)IPAddress.HostToNetworkOrder((short)row.remotePort1); localEndPoint = new IPEndPoint(row.localAddr,(int)localPort); remoteEndPoint= new IPEndPoint(row.remoteAddr,(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
- CompilationSection.cs
- Span.cs
- ListViewCancelEventArgs.cs
- CustomActivityDesigner.cs
- SByteStorage.cs
- BitmapInitialize.cs
- CodeIterationStatement.cs
- WriteableBitmap.cs
- ScaleTransform3D.cs
- WebServiceMethodData.cs
- PtsContext.cs
- MemberBinding.cs
- AvTraceFormat.cs
- tooltip.cs
- ContainerParaClient.cs
- KeyValueConfigurationElement.cs
- RawStylusInputReport.cs
- OperationAbortedException.cs
- MethodCallConverter.cs
- SqlDataSourceCache.cs
- ProcessModelInfo.cs
- ProfileSettingsCollection.cs
- SmiRecordBuffer.cs
- QuaternionAnimationBase.cs
- SamlAudienceRestrictionCondition.cs
- BoolExpression.cs
- TransformerInfoCollection.cs
- WebPartVerbCollection.cs
- Processor.cs
- AssemblyCache.cs
- GraphicsState.cs
- OwnerDrawPropertyBag.cs
- SmtpNegotiateAuthenticationModule.cs
- DataSetUtil.cs
- EncryptedReference.cs
- IERequestCache.cs
- OutputCacheProfile.cs
- StylusDevice.cs
- ADMembershipProvider.cs
- MsiStyleLogWriter.cs
- MsmqOutputMessage.cs
- MenuAutomationPeer.cs
- StreamGeometry.cs
- MethodToken.cs
- serverconfig.cs
- XmlQueryRuntime.cs
- ApplicationContext.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- DirectionalLight.cs
- ErrorHandler.cs
- FormParameter.cs
- TemplateContentLoader.cs
- HashHelpers.cs
- MessagePartDescriptionCollection.cs
- DBDataPermissionAttribute.cs
- Process.cs
- CodeTypeReferenceExpression.cs
- ApplicationActivator.cs
- ValidationHelpers.cs
- DynamicQueryableWrapper.cs
- NativeRecognizer.cs
- AppDomainAttributes.cs
- SingleAnimationBase.cs
- DetailsViewRow.cs
- counter.cs
- __FastResourceComparer.cs
- ScrollChangedEventArgs.cs
- NameTable.cs
- StylusTip.cs
- MergeLocalizationDirectives.cs
- SettingsPropertyValue.cs
- WebSysDisplayNameAttribute.cs
- updateconfighost.cs
- SchemaSetCompiler.cs
- FontInfo.cs
- AliasExpr.cs
- AdapterUtil.cs
- SelectedCellsChangedEventArgs.cs
- Stackframe.cs
- EnvironmentPermission.cs
- WebOperationContext.cs
- IntegerValidatorAttribute.cs
- SpecularMaterial.cs
- ThrowOnMultipleAssignment.cs
- AssemblyAttributes.cs
- Hash.cs
- DataGridViewMethods.cs
- FileCodeGroup.cs
- UIntPtr.cs
- XmlSerializerSection.cs
- PeerNameRecordCollection.cs
- MultiTrigger.cs
- PriorityBinding.cs
- GridViewColumnCollectionChangedEventArgs.cs
- SafeViewOfFileHandle.cs
- ReadOnlyDataSourceView.cs
- PeerSecurityHelpers.cs
- VoiceObjectToken.cs
- DataServiceException.cs
- QualificationDataAttribute.cs