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
- Paragraph.cs
- CodeTypeDeclarationCollection.cs
- QueryTaskGroupState.cs
- TableDetailsRow.cs
- StateMachineHelpers.cs
- IfElseDesigner.xaml.cs
- FaultException.cs
- MessagingDescriptionAttribute.cs
- DataObjectFieldAttribute.cs
- WSHttpSecurityElement.cs
- HyperLink.cs
- StorageScalarPropertyMapping.cs
- X509Utils.cs
- HttpClientCertificate.cs
- AutomationPeer.cs
- ListenerUnsafeNativeMethods.cs
- TransformValueSerializer.cs
- NetSectionGroup.cs
- StringValueConverter.cs
- UInt16Storage.cs
- EditingMode.cs
- TreeIterators.cs
- DataGridTextBox.cs
- counter.cs
- Math.cs
- DataGridRow.cs
- SrgsItemList.cs
- LeafCellTreeNode.cs
- PriorityQueue.cs
- CodeTypeDeclaration.cs
- _CacheStreams.cs
- DoubleIndependentAnimationStorage.cs
- QilReference.cs
- WorkflowElementDialog.cs
- WebEncodingValidator.cs
- CreateSequenceResponse.cs
- DrawingContextWalker.cs
- SessionIDManager.cs
- mda.cs
- DataView.cs
- BaseValidator.cs
- QuaternionRotation3D.cs
- EntityRecordInfo.cs
- ToolStripItem.cs
- ComplexType.cs
- DataObjectCopyingEventArgs.cs
- XsltSettings.cs
- DesignTimeTemplateParser.cs
- DispatcherProcessingDisabled.cs
- NetCodeGroup.cs
- Viewport3DVisual.cs
- TdsParserSafeHandles.cs
- BlurBitmapEffect.cs
- ItemsChangedEventArgs.cs
- ViewStateException.cs
- TypedDataSourceCodeGenerator.cs
- FlatButtonAppearance.cs
- WebPartManagerInternals.cs
- PolicyUnit.cs
- OptimizedTemplateContent.cs
- ConnectionManagementElement.cs
- VariantWrapper.cs
- AppSettingsReader.cs
- Route.cs
- HtmlWindow.cs
- CompilationUnit.cs
- OleDbParameterCollection.cs
- VisualBrush.cs
- PropertyItemInternal.cs
- DesignerForm.cs
- TextEffect.cs
- GridEntry.cs
- SingleAnimationUsingKeyFrames.cs
- DependencyPropertyKind.cs
- CredentialCache.cs
- filewebresponse.cs
- GroupJoinQueryOperator.cs
- SerializationAttributes.cs
- ProgressChangedEventArgs.cs
- TreeNodeStyle.cs
- VarRemapper.cs
- KeyGestureValueSerializer.cs
- InvokeGenerator.cs
- MetadataItemCollectionFactory.cs
- ReadOnlyAttribute.cs
- RequestCachePolicyConverter.cs
- System.Data_BID.cs
- DataPagerFieldItem.cs
- ThreadAbortException.cs
- TableLayoutPanelCodeDomSerializer.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- EventWaitHandleSecurity.cs
- NameValuePermission.cs
- PageFunction.cs
- DataGridRowsPresenter.cs
- QuadraticBezierSegment.cs
- DBSchemaTable.cs
- NumericUpDownAcceleration.cs
- _ConnectStream.cs
- PDBReader.cs