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
- ScrollEventArgs.cs
- OpenTypeMethods.cs
- SQLDouble.cs
- ResourcesChangeInfo.cs
- InkSerializer.cs
- WorkflowViewStateService.cs
- BinaryMessageFormatter.cs
- AsyncCompletedEventArgs.cs
- StateFinalizationDesigner.cs
- TrackingStringDictionary.cs
- RenderOptions.cs
- ProcessModuleCollection.cs
- SafeSecurityHandles.cs
- TypeListConverter.cs
- ButtonDesigner.cs
- DesignerLabelAdapter.cs
- SettingsPropertyValueCollection.cs
- login.cs
- SQLInt32.cs
- TextTreeObjectNode.cs
- ExternalFile.cs
- RoleGroupCollection.cs
- MdImport.cs
- ButtonChrome.cs
- HTMLTextWriter.cs
- FormsAuthenticationEventArgs.cs
- SafeRightsManagementPubHandle.cs
- CalendarDay.cs
- DaylightTime.cs
- PluralizationService.cs
- CodeGen.cs
- TypeHelper.cs
- DataMisalignedException.cs
- WizardStepBase.cs
- CollectionViewProxy.cs
- SectionRecord.cs
- XmlQueryCardinality.cs
- BitmapEffectInput.cs
- FixedLineResult.cs
- ArgumentException.cs
- ExpandCollapseProviderWrapper.cs
- ExceptionHandler.cs
- PropertyNames.cs
- ClientSettingsProvider.cs
- VisualStateChangedEventArgs.cs
- ObjectItemAssemblyLoader.cs
- ReflectionHelper.cs
- ServiceObjectContainer.cs
- XmlSchemas.cs
- WebPartTransformerAttribute.cs
- ProfileBuildProvider.cs
- ErrorTableItemStyle.cs
- BaseValidator.cs
- DataGridSortCommandEventArgs.cs
- ViewBox.cs
- ProcessMessagesAsyncResult.cs
- SettingsBase.cs
- ReceiveContextCollection.cs
- XmlHelper.cs
- GeometryHitTestResult.cs
- DirectoryNotFoundException.cs
- CheckBox.cs
- XpsResource.cs
- CodeTypeDelegate.cs
- MenuRendererStandards.cs
- DocumentGrid.cs
- ApplicationException.cs
- XmlWriterTraceListener.cs
- DesignerView.Commands.cs
- IISUnsafeMethods.cs
- RichTextBoxDesigner.cs
- IFlowDocumentViewer.cs
- ReferentialConstraint.cs
- IsolatedStoragePermission.cs
- RoleProviderPrincipal.cs
- WebPartZone.cs
- HelpEvent.cs
- DirectoryGroupQuery.cs
- DocumentGridContextMenu.cs
- Vector3DAnimationUsingKeyFrames.cs
- ResourceManagerWrapper.cs
- SqlParameterCollection.cs
- Currency.cs
- HtmlElementCollection.cs
- _LoggingObject.cs
- SqlHelper.cs
- SoundPlayer.cs
- DataGridComponentEditor.cs
- DefaultBindingPropertyAttribute.cs
- ClientTargetSection.cs
- TextRunTypographyProperties.cs
- _HeaderInfo.cs
- X509Utils.cs
- XmlSchemaNotation.cs
- PageCatalogPartDesigner.cs
- CompoundFileIOPermission.cs
- GridLengthConverter.cs
- LineProperties.cs
- ThumbAutomationPeer.cs
- ResourceAssociationSetEnd.cs