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
- ConfigXmlCDataSection.cs
- DocumentReference.cs
- ExpandSegment.cs
- Util.cs
- SkipStoryboardToFill.cs
- EffectiveValueEntry.cs
- FocusChangedEventArgs.cs
- SqlException.cs
- CollectionViewGroupRoot.cs
- PartitionResolver.cs
- ViewBox.cs
- BindableTemplateBuilder.cs
- TableLayoutPanelCellPosition.cs
- SafeNativeMethods.cs
- ManagementDateTime.cs
- StateManagedCollection.cs
- FilteredDataSetHelper.cs
- OperationResponse.cs
- NameObjectCollectionBase.cs
- DbMetaDataFactory.cs
- ShapingWorkspace.cs
- ControlValuePropertyAttribute.cs
- Attributes.cs
- MailMessage.cs
- HttpRuntime.cs
- FileLevelControlBuilderAttribute.cs
- EventLogInformation.cs
- TextDecorationUnitValidation.cs
- HandlerFactoryWrapper.cs
- WebBrowsableAttribute.cs
- ObjectViewQueryResultData.cs
- PerfCounters.cs
- DbConnectionPoolOptions.cs
- StateMachineSubscription.cs
- XMLSyntaxException.cs
- SemanticAnalyzer.cs
- CommandHelpers.cs
- AssemblyBuilder.cs
- ThumbButtonInfoCollection.cs
- ArraySortHelper.cs
- XmlAttributeOverrides.cs
- UrlPath.cs
- DecimalAnimation.cs
- SeekableMessageNavigator.cs
- Button.cs
- SoapSchemaExporter.cs
- EntityContainerEmitter.cs
- DataGrid.cs
- ReflectEventDescriptor.cs
- TraceHandler.cs
- SessionStateModule.cs
- IDReferencePropertyAttribute.cs
- TreeViewEvent.cs
- AutomationPatternInfo.cs
- EventProviderWriter.cs
- FtpCachePolicyElement.cs
- RijndaelManaged.cs
- FunctionImportMapping.cs
- GridEntry.cs
- SafeCertificateContext.cs
- GreenMethods.cs
- SplashScreen.cs
- HashMembershipCondition.cs
- PnrpPermission.cs
- KeyedPriorityQueue.cs
- DataGridViewTextBoxEditingControl.cs
- Parser.cs
- PrtTicket_Public.cs
- ObjectStateFormatter.cs
- DesignerCategoryAttribute.cs
- HttpProfileBase.cs
- StringStorage.cs
- updatecommandorderer.cs
- JavaScriptSerializer.cs
- MSAANativeProvider.cs
- XslTransform.cs
- SqlParameterCollection.cs
- ChtmlCalendarAdapter.cs
- XmlSchemaCompilationSettings.cs
- ProxyGenerator.cs
- TargetParameterCountException.cs
- BreakRecordTable.cs
- ViewEventArgs.cs
- DataServiceProviderWrapper.cs
- UIAgentRequest.cs
- Hash.cs
- EntityDataSource.cs
- Path.cs
- LoginCancelEventArgs.cs
- ObjectAnimationUsingKeyFrames.cs
- Cell.cs
- Content.cs
- TextRunCache.cs
- HtmlTableRowCollection.cs
- BmpBitmapEncoder.cs
- DeferredReference.cs
- FontWeight.cs
- EventLogInformation.cs
- ConnectionManagementElementCollection.cs
- SpanIndex.cs