Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / Sockets / _ConnectOverlappedAsyncResult.cs / 1 / _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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _CommandStream.cs
- TextEndOfParagraph.cs
- HttpWebResponse.cs
- DesignerListAdapter.cs
- UpdatePanel.cs
- DefaultValidator.cs
- Annotation.cs
- XPathDocumentBuilder.cs
- X509CertificateChain.cs
- PerfCounters.cs
- XamlInt32CollectionSerializer.cs
- HtmlElement.cs
- VerticalAlignConverter.cs
- ReferencedAssembly.cs
- IssuanceLicense.cs
- GiveFeedbackEvent.cs
- PKCS1MaskGenerationMethod.cs
- LayoutUtils.cs
- QuerySettings.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- WmlCommandAdapter.cs
- IconHelper.cs
- Brush.cs
- ToolStripRendererSwitcher.cs
- _ListenerResponseStream.cs
- TypeSemantics.cs
- SeparatorAutomationPeer.cs
- FastEncoder.cs
- SqlDataReader.cs
- XmlDataDocument.cs
- ConnectionStringsSection.cs
- InfoCardService.cs
- PreservationFileWriter.cs
- WindowsProgressbar.cs
- AdornedElementPlaceholder.cs
- SmtpLoginAuthenticationModule.cs
- safePerfProviderHandle.cs
- OptimisticConcurrencyException.cs
- DeadCharTextComposition.cs
- CodeConditionStatement.cs
- TextOnlyOutput.cs
- ClientProxyGenerator.cs
- ReadWriteSpinLock.cs
- GPPOINT.cs
- QilReplaceVisitor.cs
- TextShapeableCharacters.cs
- TogglePattern.cs
- DataRecordInfo.cs
- DetailsViewUpdateEventArgs.cs
- IdentityNotMappedException.cs
- CheckBox.cs
- LiteralControl.cs
- UpdatePanelTrigger.cs
- MatrixCamera.cs
- DesignerActionKeyboardBehavior.cs
- ImageSourceValueSerializer.cs
- xml.cs
- FixedFindEngine.cs
- Brush.cs
- ResourceBinder.cs
- ChangeToolStripParentVerb.cs
- DriveNotFoundException.cs
- ByteArrayHelperWithString.cs
- SourceElementsCollection.cs
- FormatVersion.cs
- DragCompletedEventArgs.cs
- followingsibling.cs
- LinqDataSourceHelper.cs
- httpapplicationstate.cs
- XmlSchemaInferenceException.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- CipherData.cs
- SingleStorage.cs
- TagPrefixCollection.cs
- ResponseBodyWriter.cs
- PropertyOrder.cs
- RadioButtonDesigner.cs
- WebContentFormatHelper.cs
- ReadOnlyDataSource.cs
- CompressStream.cs
- CodeSnippetExpression.cs
- ProfileGroupSettingsCollection.cs
- TypeBrowserDialog.cs
- WebPartDescriptionCollection.cs
- RawStylusInputCustomDataList.cs
- AdCreatedEventArgs.cs
- X509ChainPolicy.cs
- SourceChangedEventArgs.cs
- DataServiceHostFactory.cs
- FixedSOMTableRow.cs
- MgmtConfigurationRecord.cs
- TimeSpanConverter.cs
- WizardPanelChangingEventArgs.cs
- Error.cs
- TaskFileService.cs
- Pool.cs
- TypeForwardedToAttribute.cs
- ImageListStreamer.cs
- HitTestFilterBehavior.cs
- RSAOAEPKeyExchangeDeformatter.cs