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
- BaseCollection.cs
- DataGridViewTopLeftHeaderCell.cs
- RsaSecurityTokenAuthenticator.cs
- SingleObjectCollection.cs
- EntityWrapperFactory.cs
- SqlReferenceCollection.cs
- BaseCollection.cs
- Latin1Encoding.cs
- mediapermission.cs
- baseaxisquery.cs
- PageAsyncTaskManager.cs
- WindowsComboBox.cs
- Localizer.cs
- PropertyInformationCollection.cs
- XomlCompiler.cs
- DrawingDrawingContext.cs
- ListViewInsertedEventArgs.cs
- EmptyStringExpandableObjectConverter.cs
- PackageDigitalSignature.cs
- ExecutedRoutedEventArgs.cs
- TransformConverter.cs
- SecurityUtils.cs
- BufferedStream.cs
- UInt16Converter.cs
- AnnotationDocumentPaginator.cs
- SymDocumentType.cs
- GridViewItemAutomationPeer.cs
- TextRangeAdaptor.cs
- SharedDp.cs
- SiteMapProvider.cs
- RelatedPropertyManager.cs
- DomainUpDown.cs
- XmlEnumAttribute.cs
- ChangesetResponse.cs
- NativeMethods.cs
- DockAndAnchorLayout.cs
- DocumentPageHost.cs
- _ShellExpression.cs
- ArrayTypeMismatchException.cs
- JavascriptXmlWriterWrapper.cs
- NavigateEvent.cs
- BufferedWebEventProvider.cs
- JsonClassDataContract.cs
- LoadedEvent.cs
- VirtualizedContainerService.cs
- MimeReflector.cs
- InheritedPropertyChangedEventArgs.cs
- DataGridViewCellStyle.cs
- ApplicationServiceHelper.cs
- RequestCacheValidator.cs
- SecUtil.cs
- InertiaRotationBehavior.cs
- PreservationFileWriter.cs
- BaseTemplateParser.cs
- SpellerError.cs
- Int32.cs
- ViewService.cs
- BasicCommandTreeVisitor.cs
- SystemIPv6InterfaceProperties.cs
- Error.cs
- IndexingContentUnit.cs
- CatalogPart.cs
- WebControlAdapter.cs
- ListBox.cs
- ProviderUtil.cs
- PerspectiveCamera.cs
- DPAPIProtectedConfigurationProvider.cs
- SmiEventStream.cs
- RootBuilder.cs
- CalendarDay.cs
- DataGridViewCheckBoxCell.cs
- Duration.cs
- DefaultValueAttribute.cs
- NavigatorOutput.cs
- MarkerProperties.cs
- MultiByteCodec.cs
- TableCell.cs
- GuidelineCollection.cs
- BindingCollection.cs
- FileDialogCustomPlacesCollection.cs
- DataServiceResponse.cs
- TypeForwardedFromAttribute.cs
- IIS7WorkerRequest.cs
- BinaryNode.cs
- WebPartCloseVerb.cs
- Encoder.cs
- BrowserDefinitionCollection.cs
- InkCanvasSelection.cs
- OutputCacheProfile.cs
- Encoder.cs
- PlatformNotSupportedException.cs
- StorageTypeMapping.cs
- DataGridSortingEventArgs.cs
- MatrixConverter.cs
- BezierSegment.cs
- WorkflowTransactionService.cs
- ReadOnlyDataSource.cs
- Primitive.cs
- TerminatorSinks.cs
- AutomationElementIdentifiers.cs