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
- SystemIPAddressInformation.cs
- ParserHooks.cs
- _Semaphore.cs
- BamlRecords.cs
- ThemeInfoAttribute.cs
- SecureStringHasher.cs
- DataGridViewComboBoxCell.cs
- VisualProxy.cs
- ApplicationInfo.cs
- WindowsListViewItemStartMenu.cs
- MediaPlayerState.cs
- TdsParser.cs
- VerificationException.cs
- CalendarAutomationPeer.cs
- VersionPair.cs
- DbConnectionInternal.cs
- StorageEntityContainerMapping.cs
- QueryOpeningEnumerator.cs
- GridViewCellAutomationPeer.cs
- ToolStripPanelSelectionGlyph.cs
- CustomErrorsSection.cs
- SQLInt16Storage.cs
- MemberRestriction.cs
- _TimerThread.cs
- StringComparer.cs
- Typeface.cs
- InkCanvasSelection.cs
- DependencyPropertyKind.cs
- EntityDataSourceChangedEventArgs.cs
- Material.cs
- TextRangeEdit.cs
- CodeAssignStatement.cs
- cryptoapiTransform.cs
- XsltContext.cs
- EdmScalarPropertyAttribute.cs
- GenericRootAutomationPeer.cs
- PageCodeDomTreeGenerator.cs
- VisualBasicSettingsHandler.cs
- HtmlAnchor.cs
- XmlNodeReader.cs
- ConstraintCollection.cs
- MultipartContentParser.cs
- UseAttributeSetsAction.cs
- XmlSchemaDocumentation.cs
- listitem.cs
- TargetControlTypeCache.cs
- IDReferencePropertyAttribute.cs
- IdentitySection.cs
- XdrBuilder.cs
- ToolboxItemWrapper.cs
- SQLDateTime.cs
- RSAPKCS1SignatureFormatter.cs
- TextProperties.cs
- ExpressionParser.cs
- InOutArgument.cs
- Win32SafeHandles.cs
- EmptyElement.cs
- WebSysDisplayNameAttribute.cs
- DataGridViewIntLinkedList.cs
- BindingsSection.cs
- AddingNewEventArgs.cs
- TextLine.cs
- SplitContainer.cs
- ObjectAnimationUsingKeyFrames.cs
- ProviderBase.cs
- SqlMethodAttribute.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- PingOptions.cs
- MediaElementAutomationPeer.cs
- MemoryFailPoint.cs
- PropertyTabChangedEvent.cs
- HitTestWithGeometryDrawingContextWalker.cs
- Timer.cs
- WebPartManagerDesigner.cs
- SizeValueSerializer.cs
- GridViewEditEventArgs.cs
- AssemblyAttributes.cs
- FileSystemInfo.cs
- XmlSchemaElement.cs
- PeerApplication.cs
- MgmtConfigurationRecord.cs
- EncryptedReference.cs
- MultidimensionalArrayItemReference.cs
- HandleExceptionArgs.cs
- SqlLiftIndependentRowExpressions.cs
- ComplexTypeEmitter.cs
- RemotingException.cs
- PathFigureCollectionValueSerializer.cs
- Native.cs
- ClaimComparer.cs
- Table.cs
- ResourceProviderFactory.cs
- DataSourceConverter.cs
- Splitter.cs
- CellIdBoolean.cs
- PolyLineSegment.cs
- DNS.cs
- FilterableAttribute.cs
- ProfileInfo.cs
- ConnectionString.cs