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
- CommonXSendMessage.cs
- AutoScrollExpandMessageFilter.cs
- SimpleWebHandlerParser.cs
- XmlSchemaSet.cs
- DnsPermission.cs
- GeneratedContractType.cs
- AVElementHelper.cs
- SetterBase.cs
- FixedDocumentPaginator.cs
- KeyPullup.cs
- GenerateHelper.cs
- StrokeSerializer.cs
- XmlArrayAttribute.cs
- MappingModelBuildProvider.cs
- ConfigurationManagerInternalFactory.cs
- Context.cs
- NamespaceDisplayAutomationPeer.cs
- DragStartedEventArgs.cs
- SimpleBitVector32.cs
- FloatAverageAggregationOperator.cs
- DbModificationClause.cs
- GridViewEditEventArgs.cs
- ViewValidator.cs
- MemoryMappedViewStream.cs
- SiteMapNodeItemEventArgs.cs
- FieldMetadata.cs
- TextOutput.cs
- EntityObject.cs
- SqlXmlStorage.cs
- Transform.cs
- ThreadInterruptedException.cs
- ImagingCache.cs
- SerializationStore.cs
- CollectionViewGroupRoot.cs
- ThreadExceptionEvent.cs
- ExtenderHelpers.cs
- DbParameterCollection.cs
- NullRuntimeConfig.cs
- DateTimeConstantAttribute.cs
- EditorBrowsableAttribute.cs
- HyperLink.cs
- DeclaredTypeValidator.cs
- Accessors.cs
- X509SecurityTokenProvider.cs
- PagesSection.cs
- HttpHandler.cs
- LinqDataSource.cs
- UnitySerializationHolder.cs
- Duration.cs
- IndicCharClassifier.cs
- WebPartCollection.cs
- DataGridViewLayoutData.cs
- PageWrapper.cs
- ToggleButtonAutomationPeer.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- ToggleButtonAutomationPeer.cs
- TextServicesCompartmentContext.cs
- LinqDataSourceHelper.cs
- AlgoModule.cs
- OracleTimeSpan.cs
- WorkingDirectoryEditor.cs
- SqlConnection.cs
- SignatureHelper.cs
- TrustManagerMoreInformation.cs
- X509ChainPolicy.cs
- CompilerResults.cs
- GeneratedView.cs
- SpellerHighlightLayer.cs
- WmlImageAdapter.cs
- RowSpanVector.cs
- SmiContextFactory.cs
- ClassDataContract.cs
- SafeSystemMetrics.cs
- Literal.cs
- LoopExpression.cs
- ControlBuilderAttribute.cs
- TemplateKeyConverter.cs
- PersonalizationDictionary.cs
- PackUriHelper.cs
- AutomationProperty.cs
- DialogResultConverter.cs
- DateTimePicker.cs
- versioninfo.cs
- ActiveXHelper.cs
- Point3D.cs
- Track.cs
- ListViewSelectEventArgs.cs
- DictionaryContent.cs
- GridPatternIdentifiers.cs
- CodeDirectoryCompiler.cs
- StorageComplexPropertyMapping.cs
- FixedSOMLineCollection.cs
- SafeRightsManagementPubHandle.cs
- XmlLoader.cs
- InputScopeNameConverter.cs
- ImageEditor.cs
- XamlTemplateSerializer.cs
- ListItemViewAttribute.cs
- StrongNameUtility.cs
- FlowDocumentView.cs