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
- DecryptRequest.cs
- Substitution.cs
- MsmqAppDomainProtocolHandler.cs
- ResourceManager.cs
- AvTraceDetails.cs
- QueryTaskGroupState.cs
- ResXResourceReader.cs
- Propagator.Evaluator.cs
- GeneratedCodeAttribute.cs
- CuspData.cs
- TableItemStyle.cs
- MobileControl.cs
- ListViewUpdatedEventArgs.cs
- WebBrowser.cs
- ManagedWndProcTracker.cs
- IsolatedStoragePermission.cs
- HttpRequest.cs
- GPStream.cs
- X509Utils.cs
- WorkflowMessageEventArgs.cs
- TypeDescriptor.cs
- MimeBasePart.cs
- AuthenticationSection.cs
- SiteMap.cs
- ExceptionHandlers.cs
- EndOfStreamException.cs
- IDReferencePropertyAttribute.cs
- TrustSection.cs
- MultiSelectRootGridEntry.cs
- Perspective.cs
- HtmlForm.cs
- DataControlFieldCell.cs
- ItemContainerProviderWrapper.cs
- LineVisual.cs
- EqualityArray.cs
- AmbientValueAttribute.cs
- SystemIPGlobalStatistics.cs
- IIS7UserPrincipal.cs
- EnumBuilder.cs
- SymmetricKeyWrap.cs
- InputDevice.cs
- TransactionState.cs
- DummyDataSource.cs
- HttpWebRequest.cs
- ServiceSecurityAuditElement.cs
- MonthCalendar.cs
- future.cs
- TCEAdapterGenerator.cs
- VisualProxy.cs
- DataGridViewUtilities.cs
- RangeValidator.cs
- IPHostEntry.cs
- XmlDomTextWriter.cs
- PropertyTabChangedEvent.cs
- InvalidWorkflowException.cs
- SafeRightsManagementEnvironmentHandle.cs
- UInt64.cs
- IdnMapping.cs
- SqlNotificationRequest.cs
- CodeTypeParameterCollection.cs
- RadioButton.cs
- ObjectManager.cs
- PropertyChangedEventArgs.cs
- WebBrowserSiteBase.cs
- ConstantSlot.cs
- CommandDesigner.cs
- EncryptedData.cs
- RegistryExceptionHelper.cs
- ListItemCollection.cs
- ListenDesigner.cs
- FlowLayoutPanel.cs
- WebPartMovingEventArgs.cs
- HierarchicalDataTemplate.cs
- GreenMethods.cs
- RegisteredScript.cs
- EpmCustomContentDeSerializer.cs
- AsymmetricKeyExchangeFormatter.cs
- PathTooLongException.cs
- DataStreamFromComStream.cs
- HttpApplication.cs
- ListViewInsertEventArgs.cs
- MarginsConverter.cs
- RotationValidation.cs
- SamlDelegatingWriter.cs
- NotFiniteNumberException.cs
- UnsafeNativeMethods.cs
- Int64Storage.cs
- XmlSchemaImport.cs
- DataViewListener.cs
- EmptyStringExpandableObjectConverter.cs
- TrackingServices.cs
- SplitContainer.cs
- XmlTextReaderImpl.cs
- BeginEvent.cs
- ReaderContextStackData.cs
- Attachment.cs
- XmlDocumentFieldSchema.cs
- ProgressiveCrcCalculatingStream.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- XmlSchemaObjectTable.cs