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
- ValueType.cs
- SafeCryptContextHandle.cs
- DescendantOverDescendantQuery.cs
- SqlUtils.cs
- WebServiceMethodData.cs
- LeaseManager.cs
- BindingCollection.cs
- WebPartsPersonalizationAuthorization.cs
- PropertyGeneratedEventArgs.cs
- TypeElement.cs
- FixedFlowMap.cs
- MemberMaps.cs
- ControllableStoryboardAction.cs
- OpCodes.cs
- PersonalizablePropertyEntry.cs
- IPAddressCollection.cs
- StringValidatorAttribute.cs
- IndicFontClient.cs
- DefaultCommandConverter.cs
- PropertyIDSet.cs
- StylusSystemGestureEventArgs.cs
- CodeGotoStatement.cs
- SystemIPGlobalStatistics.cs
- SqlTopReducer.cs
- RouteItem.cs
- UriExt.cs
- IsolatedStoragePermission.cs
- UnsafePeerToPeerMethods.cs
- DirectionalLight.cs
- ComplexTypeEmitter.cs
- UpdateExpressionVisitor.cs
- ReverseQueryOperator.cs
- WindowsContainer.cs
- SchemaImporterExtensionsSection.cs
- SyncMethodInvoker.cs
- Exception.cs
- ServiceModelStringsVersion1.cs
- CollectionViewGroupInternal.cs
- SymmetricSecurityProtocolFactory.cs
- ExtenderProvidedPropertyAttribute.cs
- TableDetailsCollection.cs
- AsymmetricSignatureDeformatter.cs
- ExpressionConverter.cs
- CornerRadius.cs
- FormsIdentity.cs
- DispatcherSynchronizationContext.cs
- Facet.cs
- DataGridViewHeaderCell.cs
- PEFileEvidenceFactory.cs
- AssemblyBuilderData.cs
- OdbcErrorCollection.cs
- ValueType.cs
- TagNameToTypeMapper.cs
- MultipleViewProviderWrapper.cs
- ImageButton.cs
- HyperLinkColumn.cs
- ISAPIWorkerRequest.cs
- RegexGroupCollection.cs
- CompoundFileStreamReference.cs
- DesignerWithHeader.cs
- WebBrowsableAttribute.cs
- ObfuscationAttribute.cs
- DocumentApplicationJournalEntryEventArgs.cs
- Thread.cs
- RegexCode.cs
- SettingsPropertyWrongTypeException.cs
- CodeEventReferenceExpression.cs
- ObjectStateManager.cs
- CalculatedColumn.cs
- ObjectStateManagerMetadata.cs
- CngKeyBlobFormat.cs
- DATA_BLOB.cs
- PersonalizationAdministration.cs
- InvokeMethodDesigner.xaml.cs
- Classification.cs
- NetworkInformationException.cs
- login.cs
- AsyncStreamReader.cs
- LongPath.cs
- SiteMapNodeCollection.cs
- UrlAuthFailureHandler.cs
- Form.cs
- Assembly.cs
- ButtonStandardAdapter.cs
- Exception.cs
- clipboard.cs
- ResourceIDHelper.cs
- DataViewManagerListItemTypeDescriptor.cs
- HashAlgorithm.cs
- TrustVersion.cs
- PkcsUtils.cs
- XNodeValidator.cs
- DeviceOverridableAttribute.cs
- XPathNavigatorReader.cs
- ResourceCategoryAttribute.cs
- KeyToListMap.cs
- XmlUnspecifiedAttribute.cs
- PKCS1MaskGenerationMethod.cs
- UnwrappedTypesXmlSerializerManager.cs
- UnmanagedMemoryStreamWrapper.cs