Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / Sockets / _ConnectOverlappedAsyncResult.cs / 1 / _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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UIElementCollection.cs
- RawStylusActions.cs
- OleDbInfoMessageEvent.cs
- EventListener.cs
- MeasurementDCInfo.cs
- ProofTokenCryptoHandle.cs
- FactoryMaker.cs
- CodeAttributeArgument.cs
- UndirectedGraph.cs
- CodeDomSerializer.cs
- ListBox.cs
- SafeReversePInvokeHandle.cs
- SyndicationDeserializer.cs
- coordinator.cs
- SerializationException.cs
- CatalogZoneBase.cs
- PageEventArgs.cs
- NGCUIElementCollectionSerializerAsync.cs
- CodeCommentStatement.cs
- AutoResetEvent.cs
- ApplicationActivator.cs
- KeyPullup.cs
- PerformanceCounterPermissionAttribute.cs
- SqlCommandSet.cs
- WebServiceData.cs
- ToolBarButton.cs
- PointAnimationUsingPath.cs
- coordinatorscratchpad.cs
- Int16.cs
- SqlConnectionPoolProviderInfo.cs
- LayoutEditorPart.cs
- Vector3dCollection.cs
- Membership.cs
- FrameworkElement.cs
- WizardStepBase.cs
- ButtonField.cs
- XamlFigureLengthSerializer.cs
- WebEventCodes.cs
- DesignBindingEditor.cs
- QuaternionAnimationUsingKeyFrames.cs
- SerializationFieldInfo.cs
- QilPatternVisitor.cs
- LocalizationParserHooks.cs
- HandledMouseEvent.cs
- HtmlInputFile.cs
- StringValueSerializer.cs
- Substitution.cs
- PropertyConverter.cs
- UIAgentMonitorHandle.cs
- SparseMemoryStream.cs
- FixedNode.cs
- FontSizeConverter.cs
- ValidationSummary.cs
- SpoolingTask.cs
- OpenFileDialog.cs
- XmlSchemaFacet.cs
- PersonalizationState.cs
- ApplicationInterop.cs
- XPathSelfQuery.cs
- HandlerWithFactory.cs
- DataGridItem.cs
- SecurityRequiresReviewAttribute.cs
- WebServiceTypeData.cs
- StatusBar.cs
- AsyncOperationManager.cs
- TailCallAnalyzer.cs
- DesignTimeTemplateParser.cs
- Attachment.cs
- ObjectListItemCollection.cs
- PopupRoot.cs
- TreeView.cs
- WsatProxy.cs
- OleDbConnection.cs
- Span.cs
- CacheDependency.cs
- ClientRuntimeConfig.cs
- ImpersonateTokenRef.cs
- CodeCastExpression.cs
- RegexWorker.cs
- Clipboard.cs
- ErrorFormatterPage.cs
- xml.cs
- ButtonFieldBase.cs
- VectorValueSerializer.cs
- ObservableCollectionDefaultValueFactory.cs
- SystemTcpStatistics.cs
- _SecureChannel.cs
- GlyphRunDrawing.cs
- InvokeBinder.cs
- AmbientLight.cs
- ConfigurationValidatorBase.cs
- RegionInfo.cs
- FileLogRecord.cs
- ListBindingHelper.cs
- FeatureManager.cs
- ReceiveMessageContent.cs
- SubMenuStyle.cs
- SchemaNotation.cs
- StylusPointDescription.cs
- Parser.cs