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
- RestHandler.cs
- EntityTransaction.cs
- ThicknessAnimationUsingKeyFrames.cs
- _AutoWebProxyScriptWrapper.cs
- DataViewManagerListItemTypeDescriptor.cs
- PlacementWorkspace.cs
- linebase.cs
- ExtensionQuery.cs
- FramingChannels.cs
- DataKey.cs
- DocumentOrderComparer.cs
- HostingPreferredMapPath.cs
- AssertFilter.cs
- MemberRestriction.cs
- URLAttribute.cs
- ThreadStateException.cs
- UnmanagedMemoryStream.cs
- ButtonFlatAdapter.cs
- EngineSiteSapi.cs
- OrderPreservingPipeliningMergeHelper.cs
- EntityCommandExecutionException.cs
- CompositionTarget.cs
- TileModeValidation.cs
- TreeNodeStyle.cs
- WebPartHeaderCloseVerb.cs
- GeneralTransform.cs
- RelationshipNavigation.cs
- WebPartActionVerb.cs
- ZipFileInfo.cs
- Base64Encoder.cs
- InheritanceContextHelper.cs
- DataServiceException.cs
- ToolStripHighContrastRenderer.cs
- CodeParameterDeclarationExpression.cs
- DataRelationCollection.cs
- ClientBuildManagerCallback.cs
- RequestCachePolicyConverter.cs
- QueryExpr.cs
- StrokeRenderer.cs
- SemaphoreFullException.cs
- FormViewPageEventArgs.cs
- ProcessHostFactoryHelper.cs
- DesignerForm.cs
- PropertiesTab.cs
- BuildProviderCollection.cs
- TypeConverter.cs
- XpsFontSubsetter.cs
- XPathItem.cs
- WebServiceData.cs
- PropertyOverridesTypeEditor.cs
- LocalizabilityAttribute.cs
- Partitioner.cs
- BatchServiceHost.cs
- MatrixUtil.cs
- DataRowView.cs
- PagesSection.cs
- ToolStripDesignerAvailabilityAttribute.cs
- CatalogZone.cs
- RepeatInfo.cs
- SelectionWordBreaker.cs
- DataGridDetailsPresenter.cs
- SoundPlayer.cs
- GatewayIPAddressInformationCollection.cs
- WebPartUtil.cs
- RSACryptoServiceProvider.cs
- SnapshotChangeTrackingStrategy.cs
- Input.cs
- AppModelKnownContentFactory.cs
- PreProcessor.cs
- DrawingContextDrawingContextWalker.cs
- Monitor.cs
- EventItfInfo.cs
- ColorConverter.cs
- CacheMemory.cs
- WindowsButton.cs
- CollaborationHelperFunctions.cs
- CustomAttributeFormatException.cs
- Single.cs
- EdmToObjectNamespaceMap.cs
- SelectionItemPattern.cs
- PrimaryKeyTypeConverter.cs
- x509store.cs
- IndentedWriter.cs
- Activator.cs
- SyntaxCheck.cs
- DiagnosticStrings.cs
- DataProviderNameConverter.cs
- MarginsConverter.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- DataGridViewCheckBoxCell.cs
- ConfigXmlComment.cs
- FlowLayoutSettings.cs
- FtpWebRequest.cs
- CryptoConfig.cs
- ILGenerator.cs
- PersonalizationStateInfo.cs
- XamlReaderHelper.cs
- BlurEffect.cs
- ListDataHelper.cs
- SystemNetHelpers.cs