Code:
/ FX-1434 / FX-1434 / 1.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
- AssertSection.cs
- SafeRightsManagementSessionHandle.cs
- SafeSerializationManager.cs
- WebPartEditorCancelVerb.cs
- SaveFileDialog.cs
- httpstaticobjectscollection.cs
- TraceFilter.cs
- TreeViewBindingsEditorForm.cs
- Nodes.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- newinstructionaction.cs
- ContextStaticAttribute.cs
- RichTextBox.cs
- CheckBoxField.cs
- Padding.cs
- MessageDirection.cs
- StateMachineExecutionState.cs
- TypeDelegator.cs
- ReferenceService.cs
- DirectoryInfo.cs
- Subordinate.cs
- DayRenderEvent.cs
- ControlCollection.cs
- EpmContentDeSerializerBase.cs
- FormatException.cs
- invalidudtexception.cs
- QueryConverter.cs
- DesignRelation.cs
- BaseComponentEditor.cs
- BindingListCollectionView.cs
- SafeThreadHandle.cs
- Condition.cs
- WindowsGraphics2.cs
- XmlWriter.cs
- Wizard.cs
- SplitterPanel.cs
- BasePattern.cs
- RuntimeHelpers.cs
- SemaphoreSecurity.cs
- MailMessage.cs
- ComboBox.cs
- RotateTransform3D.cs
- HttpFormatExtensions.cs
- WebChannelFactory.cs
- WindowsNonControl.cs
- GPPOINT.cs
- AccessDataSourceDesigner.cs
- SingleKeyFrameCollection.cs
- CompilationLock.cs
- OracleConnectionString.cs
- Literal.cs
- ComponentDispatcher.cs
- Hyperlink.cs
- GiveFeedbackEvent.cs
- FontConverter.cs
- AttributeEmitter.cs
- StatusBarItemAutomationPeer.cs
- SQLByte.cs
- StringExpressionSet.cs
- AsymmetricSignatureDeformatter.cs
- Vars.cs
- ErrorWebPart.cs
- ipaddressinformationcollection.cs
- DrawingCollection.cs
- GridErrorDlg.cs
- PrtCap_Builder.cs
- ActiveDocumentEvent.cs
- Pkcs7Recipient.cs
- ElementHostAutomationPeer.cs
- FacetDescriptionElement.cs
- EntityProviderFactory.cs
- TouchFrameEventArgs.cs
- WebConvert.cs
- BufferedStream.cs
- TimelineGroup.cs
- DataGridBoolColumn.cs
- ReflectTypeDescriptionProvider.cs
- TypedColumnHandler.cs
- Duration.cs
- XmlWellformedWriter.cs
- BorderGapMaskConverter.cs
- WindowInteractionStateTracker.cs
- XmlBinaryWriter.cs
- HttpCacheParams.cs
- Grid.cs
- DataGridViewCell.cs
- ExpressionPrefixAttribute.cs
- RequestTimeoutManager.cs
- UInt64Converter.cs
- UInt32Storage.cs
- FileUtil.cs
- EnumValAlphaComparer.cs
- DataTrigger.cs
- ScrollableControl.cs
- DataSetViewSchema.cs
- ActivityStatusChangeEventArgs.cs
- BamlRecords.cs
- LoadRetryHandler.cs
- XmlSchemaAppInfo.cs
- ConfigurationManagerHelperFactory.cs