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
- CodeIdentifier.cs
- WebHttpElement.cs
- ParallelTimeline.cs
- SoapFormatExtensions.cs
- MexTcpBindingElement.cs
- PreservationFileWriter.cs
- DynamicArgumentDialog.cs
- CommandField.cs
- PatternMatcher.cs
- SafeSecurityHelper.cs
- GlobalDataBindingHandler.cs
- FixedSOMTable.cs
- AdornedElementPlaceholder.cs
- Condition.cs
- QilVisitor.cs
- OdbcException.cs
- CopyCodeAction.cs
- ShaderEffect.cs
- PeerObject.cs
- ActiveXMessageFormatter.cs
- PointHitTestResult.cs
- SQLInt16Storage.cs
- XmlHelper.cs
- TableDetailsRow.cs
- ListBindingHelper.cs
- PerfService.cs
- WebControl.cs
- TemplateControl.cs
- ServiceMemoryGates.cs
- BinaryFormatterSinks.cs
- XXXOnTypeBuilderInstantiation.cs
- Model3DGroup.cs
- BuildProviderAppliesToAttribute.cs
- ResourceDisplayNameAttribute.cs
- SemanticResolver.cs
- UriWriter.cs
- PolicyValidator.cs
- SoapFaultCodes.cs
- PerformanceCounterNameAttribute.cs
- ImageSource.cs
- ConsoleCancelEventArgs.cs
- XmlDocumentFragment.cs
- XmlHierarchyData.cs
- DesignerHelpers.cs
- httpstaticobjectscollection.cs
- DataGridCommandEventArgs.cs
- PermissionSet.cs
- UnauthorizedWebPart.cs
- RenameRuleObjectDialog.cs
- OdbcInfoMessageEvent.cs
- PasswordBoxAutomationPeer.cs
- RegistryKey.cs
- DrawingVisual.cs
- WebConfigurationHostFileChange.cs
- CapabilitiesUse.cs
- ExpandCollapseProviderWrapper.cs
- SettingsBindableAttribute.cs
- ServiceTimeoutsElement.cs
- RedirectionProxy.cs
- AccessDataSource.cs
- GeneralTransform.cs
- ScrollChrome.cs
- AsyncCompletedEventArgs.cs
- RangeBase.cs
- FixedTextPointer.cs
- xml.cs
- SqlUdtInfo.cs
- ResourceSet.cs
- SqlLiftIndependentRowExpressions.cs
- Mouse.cs
- InitializationEventAttribute.cs
- TreeNodeClickEventArgs.cs
- DelegateSerializationHolder.cs
- WinFormsSpinner.cs
- mediaeventshelper.cs
- Int32KeyFrameCollection.cs
- QueryResponse.cs
- DataBoundControlHelper.cs
- KeyEvent.cs
- SqlLiftIndependentRowExpressions.cs
- ToolStripRenderer.cs
- BufferedWebEventProvider.cs
- ColumnHeaderCollectionEditor.cs
- SQLString.cs
- ContextStack.cs
- CompilerTypeWithParams.cs
- XmlTextReaderImpl.cs
- SByteConverter.cs
- FragmentNavigationEventArgs.cs
- TableCell.cs
- XmlSchemaImporter.cs
- OutputCacheSection.cs
- PathGeometry.cs
- CodeChecksumPragma.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- LogoValidationException.cs
- ColumnResult.cs
- MetadataItem.cs
- FileDialog_Vista.cs
- ScrollPattern.cs