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
- SystemMulticastIPAddressInformation.cs
- AxisAngleRotation3D.cs
- MsmqIntegrationSecurityMode.cs
- UnaryExpression.cs
- MapPathBasedVirtualPathProvider.cs
- TreeNodeBinding.cs
- Peer.cs
- IIS7WorkerRequest.cs
- Models.cs
- Internal.cs
- SortedDictionary.cs
- DragDeltaEventArgs.cs
- UniformGrid.cs
- DataColumnMappingCollection.cs
- AuthenticationModuleElement.cs
- GridViewColumnHeader.cs
- recordstatefactory.cs
- TraceSwitch.cs
- wgx_sdk_version.cs
- TemplateManager.cs
- FrameworkContentElementAutomationPeer.cs
- DbProviderFactoriesConfigurationHandler.cs
- DataGridViewAdvancedBorderStyle.cs
- SQLInt64Storage.cs
- StylusDevice.cs
- EventDescriptor.cs
- ImageCodecInfoPrivate.cs
- ServiceOperationParameter.cs
- SamlSubject.cs
- EntityTransaction.cs
- SubclassTypeValidator.cs
- TimelineCollection.cs
- NestPullup.cs
- DockAndAnchorLayout.cs
- EndpointBehaviorElementCollection.cs
- CheckBox.cs
- WindowsScrollBar.cs
- HwndSourceKeyboardInputSite.cs
- DetailsViewModeEventArgs.cs
- ActiveDocumentEvent.cs
- FunctionQuery.cs
- OracleConnectionFactory.cs
- XmlCharCheckingReader.cs
- SingletonChannelAcceptor.cs
- XmlExceptionHelper.cs
- KeySpline.cs
- ToolZone.cs
- OletxResourceManager.cs
- VerticalAlignConverter.cs
- GridViewDeleteEventArgs.cs
- DecoderBestFitFallback.cs
- ThreadAttributes.cs
- HtmlInputText.cs
- ActivityDesigner.cs
- ByteConverter.cs
- SmiConnection.cs
- DesignBindingPropertyDescriptor.cs
- HideDisabledControlAdapter.cs
- FormatConvertedBitmap.cs
- TextCollapsingProperties.cs
- VarInfo.cs
- ItemType.cs
- ValidatedMobileControlConverter.cs
- OperatorExpressions.cs
- FixUp.cs
- ProgressBarRenderer.cs
- TraceLevelStore.cs
- SqlProviderServices.cs
- Assembly.cs
- DataTransferEventArgs.cs
- EffectiveValueEntry.cs
- DispatcherHooks.cs
- SmtpReplyReaderFactory.cs
- InputBuffer.cs
- Triangle.cs
- RbTree.cs
- CodeGroup.cs
- ListComponentEditor.cs
- ReverseInheritProperty.cs
- DataServiceRequestException.cs
- ConfigurationElementProperty.cs
- XmlKeywords.cs
- PageClientProxyGenerator.cs
- DataServiceHost.cs
- TagPrefixCollection.cs
- XmlMapping.cs
- DLinqDataModelProvider.cs
- InterleavedZipPartStream.cs
- ImportContext.cs
- ProtocolsConfigurationHandler.cs
- XmlWriter.cs
- AggregateNode.cs
- ObjectDataSourceStatusEventArgs.cs
- AsyncStreamReader.cs
- TextBoxBase.cs
- SectionInformation.cs
- UTF8Encoding.cs
- TextRange.cs
- MethodSet.cs
- SapiAttributeParser.cs