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
- CategoryList.cs
- OracleConnectionStringBuilder.cs
- DocumentSignatureManager.cs
- ConfigXmlAttribute.cs
- RIPEMD160.cs
- ObjectPropertyMapping.cs
- DataGridViewEditingControlShowingEventArgs.cs
- basevalidator.cs
- __Filters.cs
- FormDocumentDesigner.cs
- SaveCardRequest.cs
- WebPartZoneCollection.cs
- TrustSection.cs
- DrawingState.cs
- InputReport.cs
- SafeRightsManagementPubHandle.cs
- PageCodeDomTreeGenerator.cs
- IISMapPath.cs
- ConfigurationStrings.cs
- InputLanguageCollection.cs
- ManagementObjectSearcher.cs
- updatecommandorderer.cs
- DataGridViewAutoSizeModeEventArgs.cs
- LinqDataSourceView.cs
- ContainerParagraph.cs
- MailWebEventProvider.cs
- SqlDataRecord.cs
- CacheMemory.cs
- FunctionMappingTranslator.cs
- StreamReader.cs
- AmbientLight.cs
- ToolBar.cs
- PropertyPath.cs
- EntityDataSourceSelectedEventArgs.cs
- DefaultValueConverter.cs
- AngleUtil.cs
- XmlSortKeyAccumulator.cs
- BinaryMethodMessage.cs
- RightsManagementInformation.cs
- Win32.cs
- AssertFilter.cs
- SiteMapNode.cs
- AlternateViewCollection.cs
- SystemException.cs
- CodeTypeParameter.cs
- QueryOptionExpression.cs
- FormsAuthenticationModule.cs
- InternalBase.cs
- SourceElementsCollection.cs
- TouchPoint.cs
- PrimitiveCodeDomSerializer.cs
- TileModeValidation.cs
- figurelength.cs
- DefaultEventAttribute.cs
- remotingproxy.cs
- TableStyle.cs
- HtmlTableRow.cs
- ProcessThread.cs
- RecordManager.cs
- FilterUserControlBase.cs
- XamlPoint3DCollectionSerializer.cs
- IsolatedStoragePermission.cs
- DropShadowBitmapEffect.cs
- SoapInteropTypes.cs
- UndirectedGraph.cs
- InternalControlCollection.cs
- PartialArray.cs
- TypeConverter.cs
- EntityDataSourceContainerNameConverter.cs
- DataContractJsonSerializerOperationBehavior.cs
- XmlQuerySequence.cs
- BooleanAnimationBase.cs
- x509utils.cs
- TrustLevel.cs
- ContentPresenter.cs
- StrongName.cs
- StorageRoot.cs
- IssuanceTokenProviderState.cs
- IResourceProvider.cs
- BrowserDefinitionCollection.cs
- DoubleLinkListEnumerator.cs
- OutOfProcStateClientManager.cs
- TypeDescriptorContext.cs
- SyndicationSerializer.cs
- XmlAtomicValue.cs
- QilValidationVisitor.cs
- RectangleHotSpot.cs
- XmlDomTextWriter.cs
- XmlLangPropertyAttribute.cs
- NetNamedPipeBinding.cs
- XmlMemberMapping.cs
- StringPropertyBuilder.cs
- TreeNodeStyle.cs
- QueryMatcher.cs
- Operand.cs
- PermissionListSet.cs
- WorkflowInstanceSuspendedRecord.cs
- OdbcRowUpdatingEvent.cs
- ManualResetEvent.cs
- Message.cs