Code:
/ DotNET / DotNET / 8.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
- MessageLogger.cs
- CatalogZoneBase.cs
- ConfigXmlComment.cs
- CommentGlyph.cs
- AssertSection.cs
- ValueQuery.cs
- SecurityTokenException.cs
- SearchForVirtualItemEventArgs.cs
- MissingManifestResourceException.cs
- SrgsElement.cs
- CompiledELinqQueryState.cs
- DefaultMemberAttribute.cs
- WSSecurityPolicy12.cs
- ElementProxy.cs
- DtdParser.cs
- AudioLevelUpdatedEventArgs.cs
- ForceCopyBuildProvider.cs
- SoapException.cs
- PassportAuthenticationModule.cs
- CheckBoxField.cs
- TransportContext.cs
- StateDesigner.cs
- MetabaseReader.cs
- ParagraphVisual.cs
- WebPartDescriptionCollection.cs
- VisualBasicExpressionConverter.cs
- ConfigurationException.cs
- DeviceContext.cs
- JsonSerializer.cs
- XmlSchemaSimpleTypeList.cs
- ToolstripProfessionalRenderer.cs
- LightweightCodeGenerator.cs
- RuntimeCompatibilityAttribute.cs
- ResourcePool.cs
- AssemblyAssociatedContentFileAttribute.cs
- StringToken.cs
- EventLogEntryCollection.cs
- DbDataRecord.cs
- EncoderParameters.cs
- TokenBasedSetEnumerator.cs
- ConnectionManagementSection.cs
- Rotation3DAnimationBase.cs
- OracleParameterBinding.cs
- XmlSchemaInclude.cs
- ItemCollection.cs
- ReferencedAssembly.cs
- HScrollProperties.cs
- HandleCollector.cs
- SQLMembershipProvider.cs
- BaseValidatorDesigner.cs
- CompressionTransform.cs
- OleStrCAMarshaler.cs
- SiteMapNodeItemEventArgs.cs
- CompositionDesigner.cs
- RuntimeHelpers.cs
- RegexCapture.cs
- TypedElement.cs
- Environment.cs
- Rect3D.cs
- RotationValidation.cs
- ComponentEditorForm.cs
- LoginStatusDesigner.cs
- XslCompiledTransform.cs
- SqlParameter.cs
- DrawingAttributes.cs
- CodeTypeMember.cs
- RuntimeHelpers.cs
- ImageResources.Designer.cs
- RichTextBox.cs
- PersonalizationProvider.cs
- HttpCookieCollection.cs
- QueueSurrogate.cs
- HtmlUtf8RawTextWriter.cs
- InputScope.cs
- SymbolPair.cs
- TraceHwndHost.cs
- OleDbMetaDataFactory.cs
- XmlSerializationReader.cs
- EntityDescriptor.cs
- CheckedListBox.cs
- SmiConnection.cs
- TypeGeneratedEventArgs.cs
- GiveFeedbackEvent.cs
- AudioException.cs
- HtmlHead.cs
- SchemaImporterExtensionElement.cs
- StylusPointPropertyInfoDefaults.cs
- DispatchChannelSink.cs
- ProviderMetadataCachedInformation.cs
- SymmetricAlgorithm.cs
- DomainLiteralReader.cs
- ProgressPage.cs
- UriExt.cs
- securitycriticaldataClass.cs
- MemoryStream.cs
- Int64KeyFrameCollection.cs
- XdrBuilder.cs
- TableRowGroupCollection.cs
- GeometryModel3D.cs
- SqlFunctionAttribute.cs