Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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 are incorrect 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;}} } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MonthCalendarDesigner.cs
- CoreChannel.cs
- PointCollection.cs
- SizeAnimationClockResource.cs
- EntitySetBaseCollection.cs
- QualificationDataItem.cs
- PerspectiveCamera.cs
- documentsequencetextpointer.cs
- HttpsChannelFactory.cs
- BuildProviderAppliesToAttribute.cs
- SqlInfoMessageEvent.cs
- Codec.cs
- LayoutEditorPart.cs
- LiteralControl.cs
- StreamedWorkflowDefinitionContext.cs
- WriteFileContext.cs
- FixedSOMTableCell.cs
- CharEntityEncoderFallback.cs
- CustomErrorsSection.cs
- CookielessHelper.cs
- FixedSchema.cs
- SafeEventLogWriteHandle.cs
- WebBrowserNavigatedEventHandler.cs
- EntryIndex.cs
- TextParagraphCache.cs
- RegionIterator.cs
- ConnectorDragDropGlyph.cs
- Error.cs
- XsdCachingReader.cs
- PartManifestEntry.cs
- KerberosTicketHashIdentifierClause.cs
- CatalogPart.cs
- ScrollBar.cs
- LineServices.cs
- CollectionViewSource.cs
- DocumentPageTextView.cs
- SqlFormatter.cs
- Input.cs
- MailWebEventProvider.cs
- TextDocumentView.cs
- KeyNotFoundException.cs
- DiscoveryCallbackBehavior.cs
- NativeWrapper.cs
- CursorConverter.cs
- CharacterBuffer.cs
- QuaternionAnimationBase.cs
- PartialCachingAttribute.cs
- CompositeDuplexBindingElement.cs
- QuaternionRotation3D.cs
- TransactionBridge.cs
- CommandBinding.cs
- LZCodec.cs
- AddInActivator.cs
- SqlUserDefinedTypeAttribute.cs
- NamespaceQuery.cs
- FullTextLine.cs
- ArgumentException.cs
- ProfileBuildProvider.cs
- util.cs
- CollectionContainer.cs
- CommonEndpointBehaviorElement.cs
- SchemaAttDef.cs
- Attributes.cs
- UIElementParagraph.cs
- XslTransform.cs
- HttpCachePolicyElement.cs
- InstanceHandleReference.cs
- WeakReferenceEnumerator.cs
- DefaultTextStore.cs
- DataGridViewElement.cs
- DatePickerDateValidationErrorEventArgs.cs
- UIElementHelper.cs
- XmlDownloadManager.cs
- KeyValueSerializer.cs
- Calendar.cs
- AssemblyHelper.cs
- IOException.cs
- MatrixKeyFrameCollection.cs
- SqlCachedBuffer.cs
- DrawListViewSubItemEventArgs.cs
- ViewValidator.cs
- XamlFxTrace.cs
- SoapElementAttribute.cs
- EncodingInfo.cs
- AccessControlEntry.cs
- AnimationLayer.cs
- SiteMapHierarchicalDataSourceView.cs
- BuildProviderAppliesToAttribute.cs
- _AutoWebProxyScriptWrapper.cs
- SqlErrorCollection.cs
- TrackBar.cs
- ResourceAttributes.cs
- OpCellTreeNode.cs
- TextBounds.cs
- Classification.cs
- SpeakInfo.cs
- CodeDOMUtility.cs
- OracleRowUpdatingEventArgs.cs
- WorkflowWebService.cs
- BodyGlyph.cs