Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- Activator.cs
- ExtensibleClassFactory.cs
- Scalars.cs
- DataObjectFieldAttribute.cs
- TextAnchor.cs
- TableAutomationPeer.cs
- SessionIDManager.cs
- RuntimeConfig.cs
- SimpleWorkerRequest.cs
- ProviderConnectionPointCollection.cs
- EUCJPEncoding.cs
- TemplateColumn.cs
- CustomWebEventKey.cs
- StyleHelper.cs
- HandlerFactoryCache.cs
- SingleAnimationBase.cs
- HtmlTextArea.cs
- EventLogPermissionAttribute.cs
- ThreadSafeList.cs
- CharEnumerator.cs
- ProfileSettings.cs
- WebPartMovingEventArgs.cs
- ZipPackage.cs
- ErrorHandlingReceiver.cs
- Parameter.cs
- ContractValidationHelper.cs
- EpmCustomContentWriterNodeData.cs
- HtmlEmptyTagControlBuilder.cs
- CollectionContainer.cs
- LinkConverter.cs
- DispatcherExceptionFilterEventArgs.cs
- XmlDomTextWriter.cs
- DocumentApplication.cs
- PenCursorManager.cs
- Soap12ServerProtocol.cs
- RoleGroupCollectionEditor.cs
- MeasurementDCInfo.cs
- TableLayoutSettings.cs
- InvariantComparer.cs
- RoleService.cs
- EnglishPluralizationService.cs
- ToolStripLabel.cs
- HitTestWithGeometryDrawingContextWalker.cs
- StringFormat.cs
- TableRow.cs
- XmlSchemaFacet.cs
- StyleCollection.cs
- ConnectionsZone.cs
- ItemCheckedEvent.cs
- Vector3D.cs
- XmlEntity.cs
- ConstraintConverter.cs
- InputLangChangeEvent.cs
- CoTaskMemUnicodeSafeHandle.cs
- NativeMethods.cs
- Assert.cs
- SystemUdpStatistics.cs
- MetadataArtifactLoaderCompositeResource.cs
- DrawingAttributes.cs
- HelpKeywordAttribute.cs
- ClientScriptManagerWrapper.cs
- Action.cs
- TextProviderWrapper.cs
- PictureBox.cs
- SchemeSettingElementCollection.cs
- WebPartEditorApplyVerb.cs
- DefaultHttpHandler.cs
- filewebresponse.cs
- BamlLocalizableResourceKey.cs
- DecoderExceptionFallback.cs
- ActivityCollectionMarkupSerializer.cs
- SeekableMessageNavigator.cs
- TakeOrSkipWhileQueryOperator.cs
- WindowVisualStateTracker.cs
- FileStream.cs
- DynamicQueryableWrapper.cs
- ComponentDispatcher.cs
- ConfigurationValidatorAttribute.cs
- ReliableSession.cs
- ResourceExpressionBuilder.cs
- SmtpSection.cs
- CursorInteropHelper.cs
- ProfilePropertySettingsCollection.cs
- ConstraintManager.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- EventLogWatcher.cs
- XmlName.cs
- DefaultProxySection.cs
- Comparer.cs
- MeshGeometry3D.cs
- DataGridTable.cs
- SourceFileBuildProvider.cs
- StateDesigner.CommentLayoutGlyph.cs
- ConstructorNeedsTagAttribute.cs
- AssociationSetMetadata.cs
- MessageQueueAccessControlEntry.cs
- NameHandler.cs
- SmuggledIUnknown.cs
- WrappedIUnknown.cs
- PlaceHolder.cs