Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SQLCharsStorage.cs
- BitmapEffectGroup.cs
- DataGridViewComboBoxCell.cs
- DataGridTablesFactory.cs
- SessionEndedEventArgs.cs
- StateRuntime.cs
- OutputCacheSettingsSection.cs
- TCPClient.cs
- DesignerLoader.cs
- DbParameterHelper.cs
- PostBackTrigger.cs
- ExpressionBuilderContext.cs
- ValueTable.cs
- Utility.cs
- Publisher.cs
- NativeMethods.cs
- VoiceSynthesis.cs
- VariantWrapper.cs
- LongTypeConverter.cs
- GeometryCollection.cs
- ProfileManager.cs
- DataGridViewTextBoxCell.cs
- UnsafeNativeMethods.cs
- BlurBitmapEffect.cs
- CallbackHandler.cs
- TypeConverterValueSerializer.cs
- Stylus.cs
- PropertyPathConverter.cs
- ETagAttribute.cs
- DecimalAnimationUsingKeyFrames.cs
- ValidateNames.cs
- FontFamily.cs
- WebPermission.cs
- TrueReadOnlyCollection.cs
- Blend.cs
- ISCIIEncoding.cs
- IteratorFilter.cs
- ProtocolElementCollection.cs
- UpdatePanelTriggerCollection.cs
- EncryptedType.cs
- LinkedList.cs
- LocalServiceSecuritySettingsElement.cs
- EnumValidator.cs
- TreeNodeStyleCollection.cs
- SmiMetaDataProperty.cs
- RenderTargetBitmap.cs
- ResetableIterator.cs
- RelativeSource.cs
- TreeView.cs
- SelectiveScrollingGrid.cs
- wmiprovider.cs
- ProfileSettings.cs
- ObjectAnimationUsingKeyFrames.cs
- MenuAdapter.cs
- ScrollChrome.cs
- KeyGesture.cs
- PolicyValidationException.cs
- ValidationErrorEventArgs.cs
- PixelFormatConverter.cs
- CellLabel.cs
- SystemResources.cs
- SkinBuilder.cs
- CallSiteBinder.cs
- StylusDevice.cs
- ButtonBase.cs
- JournalEntry.cs
- ReachFixedPageSerializer.cs
- KeyBinding.cs
- ObjectIDGenerator.cs
- ThreadAttributes.cs
- Fonts.cs
- DataObjectSettingDataEventArgs.cs
- BinaryFormatterWriter.cs
- ToolBarTray.cs
- StatusBar.cs
- GroupBox.cs
- AliasedExpr.cs
- Validator.cs
- WorkflowServiceNamespace.cs
- HostVisual.cs
- MissingMemberException.cs
- XmlNamespaceMappingCollection.cs
- HttpApplicationFactory.cs
- HtmlContainerControl.cs
- StickyNoteAnnotations.cs
- EventEntry.cs
- RepeatBehaviorConverter.cs
- _SslStream.cs
- PerfCounterSection.cs
- HostDesigntimeLicenseContext.cs
- ArcSegment.cs
- UserPreferenceChangingEventArgs.cs
- ImageProxy.cs
- ControlCollection.cs
- ComPlusTypeValidator.cs
- FeatureSupport.cs
- Utils.cs
- SessionStateItemCollection.cs
- TextSelectionHighlightLayer.cs
- KoreanLunisolarCalendar.cs