Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- GridViewRowCollection.cs
- ProgressPage.cs
- DropShadowBitmapEffect.cs
- lengthconverter.cs
- WindowsFormsSynchronizationContext.cs
- CacheRequest.cs
- SharedTcpTransportManager.cs
- BamlTreeUpdater.cs
- XmlSchemaInferenceException.cs
- BufferedWebEventProvider.cs
- Cursor.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- Inline.cs
- XmlEnumAttribute.cs
- ListComponentEditorPage.cs
- KerberosTicketHashIdentifierClause.cs
- OuterGlowBitmapEffect.cs
- FontCacheLogic.cs
- DiagnosticTrace.cs
- OlePropertyStructs.cs
- IgnoreFlushAndCloseStream.cs
- DataRow.cs
- FrameworkTemplate.cs
- XPathDescendantIterator.cs
- Model3DGroup.cs
- ValueTypeFixupInfo.cs
- ParallelRangeManager.cs
- ActivityBuilderXamlWriter.cs
- WebServiceParameterData.cs
- ClientCultureInfo.cs
- XmlIlGenerator.cs
- ListenerUnsafeNativeMethods.cs
- SelectionUIService.cs
- UpdatePanelControlTrigger.cs
- WebPartConnectionsCancelEventArgs.cs
- WebPartUtil.cs
- ConvertEvent.cs
- HMACSHA512.cs
- TextElementEnumerator.cs
- HMACSHA256.cs
- ListSortDescriptionCollection.cs
- SerializableAttribute.cs
- QilInvokeEarlyBound.cs
- RuleInfoComparer.cs
- filewebrequest.cs
- ExpressionVisitorHelpers.cs
- BufferedConnection.cs
- CompositeKey.cs
- DataGridCellsPresenter.cs
- ComponentSerializationService.cs
- sqlmetadatafactory.cs
- XmlAttributeOverrides.cs
- NameObjectCollectionBase.cs
- URLBuilder.cs
- MemoryStream.cs
- WebPartTransformer.cs
- MatrixCamera.cs
- CommandConverter.cs
- ValidationError.cs
- ScrollViewer.cs
- ObjectTag.cs
- XPathDocumentIterator.cs
- TailPinnedEventArgs.cs
- LineMetrics.cs
- PageCopyCount.cs
- GenerateScriptTypeAttribute.cs
- CryptoKeySecurity.cs
- NamedPipeWorkerProcess.cs
- ClockGroup.cs
- basenumberconverter.cs
- OutKeywords.cs
- PipeSecurity.cs
- ToolStripPanel.cs
- ProfileProvider.cs
- CustomAttribute.cs
- Shape.cs
- _BasicClient.cs
- ErrorRuntimeConfig.cs
- DataViewSetting.cs
- GridViewAutomationPeer.cs
- exports.cs
- MailMessage.cs
- ConnectionProviderAttribute.cs
- InitializingNewItemEventArgs.cs
- GridViewDeletedEventArgs.cs
- KerberosTicketHashIdentifierClause.cs
- SafeArrayRankMismatchException.cs
- GlobalId.cs
- UnaryNode.cs
- MessageQueuePermissionEntryCollection.cs
- SoapAttributeAttribute.cs
- CompilationLock.cs
- PerformanceCounterScope.cs
- BamlCollectionHolder.cs
- OleDbConnectionFactory.cs
- ListViewGroupConverter.cs
- DynamicDocumentPaginator.cs
- ManualResetEvent.cs
- DSACryptoServiceProvider.cs
- CodeTypeOfExpression.cs