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
- ResolveNextArgumentWorkItem.cs
- DecimalStorage.cs
- ToolStripOverflow.cs
- HybridDictionary.cs
- BaseTemplateCodeDomTreeGenerator.cs
- AssemblyInfo.cs
- EntityWithKeyStrategy.cs
- DataTableMappingCollection.cs
- StyleBamlRecordReader.cs
- SmtpSection.cs
- TableItemPattern.cs
- Visual3D.cs
- TypeElementCollection.cs
- FrameworkObject.cs
- Material.cs
- ButtonBaseAdapter.cs
- OdbcErrorCollection.cs
- OdbcErrorCollection.cs
- Section.cs
- PersonalizationEntry.cs
- ClientFormsIdentity.cs
- MarkupExtensionParser.cs
- ExportOptions.cs
- ManipulationDevice.cs
- DomNameTable.cs
- FieldBuilder.cs
- ColumnTypeConverter.cs
- ImageListUtils.cs
- Int64AnimationUsingKeyFrames.cs
- ExtensionQuery.cs
- HttpWebRequestElement.cs
- datacache.cs
- securitymgrsite.cs
- CookieProtection.cs
- StopStoryboard.cs
- ObjectDataSourceDisposingEventArgs.cs
- RtfControlWordInfo.cs
- MultiTrigger.cs
- CallbackCorrelationInitializer.cs
- WebHttpSecurityModeHelper.cs
- ListViewItem.cs
- Bitmap.cs
- SpellerHighlightLayer.cs
- ContractCodeDomInfo.cs
- SafeNativeMethods.cs
- ObjectStateManagerMetadata.cs
- Array.cs
- ViewSimplifier.cs
- ListItemConverter.cs
- BaseValidator.cs
- PagerStyle.cs
- AuthenticodeSignatureInformation.cs
- XamlFilter.cs
- LinearGradientBrush.cs
- ParameterCollectionEditor.cs
- MetadataCacheItem.cs
- HashCryptoHandle.cs
- StoreItemCollection.cs
- RSAPKCS1SignatureDeformatter.cs
- SharedConnectionWorkflowTransactionService.cs
- RandomNumberGenerator.cs
- ChangeBlockUndoRecord.cs
- GeometryModel3D.cs
- RowParagraph.cs
- XmlSchemaFacet.cs
- UIElement.cs
- ReferentialConstraint.cs
- OleDbConnection.cs
- ProcessHost.cs
- XmlArrayItemAttributes.cs
- SoapCommonClasses.cs
- PropertyTabAttribute.cs
- PointUtil.cs
- IFlowDocumentViewer.cs
- NullableIntAverageAggregationOperator.cs
- __Filters.cs
- TextEditorTables.cs
- TemplateParser.cs
- SortedList.cs
- ColorPalette.cs
- PtsHelper.cs
- ProviderException.cs
- Signature.cs
- TypeUtil.cs
- NetNamedPipeBinding.cs
- SignatureToken.cs
- StringTraceRecord.cs
- TextRenderer.cs
- PrintEvent.cs
- CqlLexer.cs
- PreloadedPackages.cs
- LayoutDump.cs
- RuleSettings.cs
- WebPartCloseVerb.cs
- EventToken.cs
- MachineKeySection.cs
- OleDbInfoMessageEvent.cs
- RemoteAsymmetricSignatureFormatter.cs
- DataControlButton.cs
- InputLanguage.cs