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
- Renderer.cs
- SmiEventSink_DeferedProcessing.cs
- SafeEventLogWriteHandle.cs
- DataTableNewRowEvent.cs
- TabItemWrapperAutomationPeer.cs
- FastEncoderWindow.cs
- Axis.cs
- FontCacheUtil.cs
- RepeaterItemCollection.cs
- HtmlGenericControl.cs
- PerformanceCounterPermissionEntryCollection.cs
- ToReply.cs
- Message.cs
- DataPagerFieldCommandEventArgs.cs
- SvcMapFileSerializer.cs
- DesignColumn.cs
- ResourceContainer.cs
- TypeGeneratedEventArgs.cs
- MultiTrigger.cs
- UnknownBitmapDecoder.cs
- GlobalProxySelection.cs
- BuildManager.cs
- DataGridView.cs
- SqlWebEventProvider.cs
- SemaphoreFullException.cs
- NullRuntimeConfig.cs
- TableParaClient.cs
- PrintDocument.cs
- FormClosedEvent.cs
- ErrorWrapper.cs
- AdjustableArrowCap.cs
- EdgeModeValidation.cs
- DocumentXmlWriter.cs
- ControlAdapter.cs
- DataGridCellItemAutomationPeer.cs
- LeaseManager.cs
- WsdlWriter.cs
- XamlWrappingReader.cs
- XmlSchemaIdentityConstraint.cs
- MaterialGroup.cs
- TabItemWrapperAutomationPeer.cs
- ListBoxAutomationPeer.cs
- BoolExpression.cs
- WebSysDefaultValueAttribute.cs
- UnsettableComboBox.cs
- SiteMembershipCondition.cs
- ListDictionaryInternal.cs
- ControlPropertyNameConverter.cs
- Queue.cs
- RichTextBox.cs
- DefinitionBase.cs
- DocumentAutomationPeer.cs
- Processor.cs
- ArgIterator.cs
- TrackingProfileCache.cs
- OleCmdHelper.cs
- CuspData.cs
- TargetFrameworkUtil.cs
- OdbcStatementHandle.cs
- Axis.cs
- AttachmentCollection.cs
- PropertyPathConverter.cs
- WorkflowFileItem.cs
- Keyboard.cs
- ImageListDesigner.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- BitConverter.cs
- BinaryConverter.cs
- NameNode.cs
- ResourcePermissionBaseEntry.cs
- UriSection.cs
- SmtpReplyReaderFactory.cs
- InputBinder.cs
- ConfigurationStrings.cs
- DrawingContextWalker.cs
- GroupItemAutomationPeer.cs
- ByteAnimationUsingKeyFrames.cs
- CorrelationValidator.cs
- MembershipValidatePasswordEventArgs.cs
- Workspace.cs
- CodeTypeOfExpression.cs
- StyleBamlRecordReader.cs
- DoneReceivingAsyncResult.cs
- Literal.cs
- PolyBezierSegment.cs
- OdbcUtils.cs
- KeyInfo.cs
- AnonymousIdentificationModule.cs
- SqlSelectStatement.cs
- CompilerError.cs
- MatrixAnimationUsingPath.cs
- EnumUnknown.cs
- CompiledELinqQueryState.cs
- CatalogZoneBase.cs
- HijriCalendar.cs
- BinaryObjectReader.cs
- FormParameter.cs
- SoapReflectionImporter.cs
- ControlPropertyNameConverter.cs
- ControlDesigner.cs