Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Sockets / _ConnectOverlappedAsyncResult.cs / 2 / _ConnectOverlappedAsyncResult.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Sockets { using System; using System.Net; using System.Runtime.InteropServices; using System.Threading; using Microsoft.Win32; // // ConnectOverlappedAsyncResult - used to take care of storage for async Socket BeginAccept call. // internal class ConnectOverlappedAsyncResult : BaseOverlappedAsyncResult { private EndPoint m_EndPoint; internal ConnectOverlappedAsyncResult(Socket socket, EndPoint endPoint, Object asyncState, AsyncCallback asyncCallback): base(socket,asyncState,asyncCallback) { m_EndPoint = endPoint; } // // This method is called by base.CompletionPortCallback base.OverlappedCallback as part of IO completion // internal override object PostCompletion(int numBytes) { SocketError errorCode = (SocketError)ErrorCode; Socket socket = (Socket)AsyncObject; if (errorCode==SocketError.Success) { //set the socket context try { errorCode = UnsafeNclNativeMethods.OSSOCK.setsockopt( socket.SafeHandle, SocketOptionLevel.Socket, SocketOptionName.UpdateConnectContext, null, 0); if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); } catch (ObjectDisposedException) { errorCode = SocketError.OperationAborted; } ErrorCode = (int) errorCode; } if (errorCode==SocketError.Success) { socket.SetToConnected(); return socket; } return null; } internal EndPoint RemoteEndPoint { get { return m_EndPoint; } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignerHelpers.cs
- XmlDocumentSerializer.cs
- EventLogPermissionEntryCollection.cs
- FlowchartDesigner.xaml.cs
- SignedXml.cs
- BitmapEffectGroup.cs
- TransformProviderWrapper.cs
- DataMemberConverter.cs
- BindUriHelper.cs
- PassportAuthenticationEventArgs.cs
- CodeDefaultValueExpression.cs
- DataColumnMapping.cs
- DrawingBrush.cs
- AccessedThroughPropertyAttribute.cs
- InputLanguageEventArgs.cs
- MimeTypeMapper.cs
- LayoutTable.cs
- Transform3D.cs
- ManagementDateTime.cs
- AssemblyCache.cs
- FunctionQuery.cs
- AssemblyLoader.cs
- Cloud.cs
- PixelFormats.cs
- GridViewUpdateEventArgs.cs
- DataSourceView.cs
- XmlNullResolver.cs
- QuaternionRotation3D.cs
- StorageFunctionMapping.cs
- Int16.cs
- CaseInsensitiveOrdinalStringComparer.cs
- XmlSchemaAnnotation.cs
- BamlLocalizabilityResolver.cs
- CodeEntryPointMethod.cs
- ObjectDataSourceSelectingEventArgs.cs
- CompiledWorkflowDefinitionContext.cs
- AnnotationResourceChangedEventArgs.cs
- WeakReference.cs
- ControlValuePropertyAttribute.cs
- DSGeneratorProblem.cs
- QuotedPrintableStream.cs
- TimelineClockCollection.cs
- CreateUserErrorEventArgs.cs
- CallbackValidator.cs
- HostedImpersonationContext.cs
- MediaSystem.cs
- ToolTip.cs
- ExpandSegmentCollection.cs
- LZCodec.cs
- DetailsViewInsertedEventArgs.cs
- DataSourceConverter.cs
- CqlErrorHelper.cs
- BinaryFormatter.cs
- PersonalizationProviderHelper.cs
- SiteMapProvider.cs
- BaseValidator.cs
- Size.cs
- CompositeScriptReferenceEventArgs.cs
- AsymmetricSignatureFormatter.cs
- PeerContact.cs
- ScrollProviderWrapper.cs
- ClientBuildManagerCallback.cs
- MsmqInputChannelBase.cs
- PageContentCollection.cs
- MobileCapabilities.cs
- SafeArrayRankMismatchException.cs
- SoapInteropTypes.cs
- AlternateView.cs
- BaseUriWithWildcard.cs
- UDPClient.cs
- MessageVersion.cs
- ListItem.cs
- Size.cs
- HwndAppCommandInputProvider.cs
- CqlWriter.cs
- BaseCAMarshaler.cs
- SQLInt32.cs
- ValueTable.cs
- DefaultShape.cs
- EntityDataSourceState.cs
- GlyphTypeface.cs
- MiniModule.cs
- ValueSerializer.cs
- SByte.cs
- SessionPageStatePersister.cs
- OracleRowUpdatingEventArgs.cs
- PagerSettings.cs
- odbcmetadatacolumnnames.cs
- SubMenuStyle.cs
- SecurityCriticalDataForSet.cs
- InfoCardBaseException.cs
- ColumnReorderedEventArgs.cs
- InvariantComparer.cs
- Char.cs
- ConfigurationManager.cs
- xsdvalidator.cs
- MSAAEventDispatcher.cs
- SQLMoney.cs
- ParallelTimeline.cs
- ComponentCollection.cs