Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / NetworkInformation / SystemTcpConnection.cs / 1305376 / 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.localPort1<<8|row.localPort2; int remotePort = ((state == TcpState.Listen)?0:row.remotePort1<<8|row.remotePort2); localEndPoint = new IPEndPoint(row.localAddr,(int)localPort); remoteEndPoint= new IPEndPoint(row.remoteAddr,(int)remotePort); } // IPV6 version of the Tcp row internal SystemTcpConnectionInformation(MibTcp6RowOwnerPid 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.localPort1 << 8 | row.localPort2; int remotePort = ((state == TcpState.Listen) ? 0 : row.remotePort1 << 8 | row.remotePort2); localEndPoint = new IPEndPoint(new IPAddress(row.localAddr, row.localScopeId), (int)localPort); remoteEndPoint = new IPEndPoint(new IPAddress(row.remoteAddr, row.remoteScopeId), (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
- ConnectionInterfaceCollection.cs
- _SecureChannel.cs
- RuleDefinitions.cs
- InvokePattern.cs
- BindingObserver.cs
- _SslSessionsCache.cs
- DescendantOverDescendantQuery.cs
- ACE.cs
- PropertyEntry.cs
- PeoplePickerWrapper.cs
- MailWriter.cs
- GridView.cs
- SqlEnums.cs
- RequestSecurityTokenResponse.cs
- X509Extension.cs
- MetadataArtifactLoaderComposite.cs
- TextElementCollection.cs
- SqlStatistics.cs
- LabelLiteral.cs
- Scripts.cs
- remotingproxy.cs
- DeclarativeCatalogPart.cs
- ClientFormsIdentity.cs
- Brush.cs
- ButtonFieldBase.cs
- PathSegment.cs
- ChangePasswordDesigner.cs
- HandlerBase.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- Debugger.cs
- BoolExpr.cs
- ConnectionOrientedTransportChannelFactory.cs
- FactoryGenerator.cs
- StandardBindingImporter.cs
- WebPartConnection.cs
- EventDriven.cs
- VBCodeProvider.cs
- HyperLinkStyle.cs
- sqlstateclientmanager.cs
- Error.cs
- SqlTriggerContext.cs
- _HeaderInfoTable.cs
- TextParagraphView.cs
- OleCmdHelper.cs
- ToolStripControlHost.cs
- SerialPort.cs
- CannotUnloadAppDomainException.cs
- CfgArc.cs
- ResourceAttributes.cs
- CSharpCodeProvider.cs
- HttpModuleActionCollection.cs
- TextAction.cs
- CodeChecksumPragma.cs
- DefaultProxySection.cs
- LinqDataSourceContextEventArgs.cs
- DataGridViewTopRowAccessibleObject.cs
- TraceSource.cs
- DecoderReplacementFallback.cs
- TypeToken.cs
- TreeNodeEventArgs.cs
- AspNetCompatibilityRequirementsMode.cs
- CategoryGridEntry.cs
- WebExceptionStatus.cs
- configsystem.cs
- WebPartCatalogCloseVerb.cs
- LazyTextWriterCreator.cs
- StandardOleMarshalObject.cs
- CompModSwitches.cs
- UshortList2.cs
- CachingHintValidation.cs
- ReturnType.cs
- IISUnsafeMethods.cs
- Int16AnimationBase.cs
- DetailsViewRowCollection.cs
- DynamicRendererThreadManager.cs
- DetailsViewUpdateEventArgs.cs
- AutomationPattern.cs
- DocumentSchemaValidator.cs
- SpecialNameAttribute.cs
- Marshal.cs
- HttpWebResponse.cs
- PenCursorManager.cs
- FaultFormatter.cs
- ILGenerator.cs
- XmlNullResolver.cs
- PrePostDescendentsWalker.cs
- EventProviderWriter.cs
- Calendar.cs
- WebPartAddingEventArgs.cs
- SecurityKeyIdentifier.cs
- ItemCheckedEvent.cs
- AssemblyResourceLoader.cs
- IPEndPointCollection.cs
- ColumnCollection.cs
- WorkerRequest.cs
- DirectoryRedirect.cs
- RequestQueue.cs
- CompileLiteralTextParser.cs
- ClipboardProcessor.cs
- VariableAction.cs