Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / SocketException.cs / 2 / SocketException.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Sockets {
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
///
///
/// Provides socket exceptions to the application.
///
///
[Serializable]
public class SocketException : Win32Exception {
[NonSerialized]
private EndPoint m_EndPoint;
///
///
/// Creates a new instance of the class with the default error code.
///
///
public SocketException() : base(Marshal.GetLastWin32Error()) {
GlobalLog.Print("SocketException::.ctor() " + NativeErrorCode.ToString() + ":" + Message);
}
internal SocketException(EndPoint endPoint) : base(Marshal.GetLastWin32Error()) {
m_EndPoint = endPoint;
}
///
///
/// Creates a new instance of the class with the specified error code.
///
///
public SocketException(int errorCode) : base(errorCode) {
GlobalLog.Print("SocketException::.ctor(int) " + NativeErrorCode.ToString() + ":" + Message);
}
internal SocketException(int errorCode, EndPoint endPoint) : base(errorCode) {
m_EndPoint = endPoint;
}
///
///
/// Creates a new instance of the class with the specified error code as SocketError.
///
///
internal SocketException(SocketError socketError) : base((int)socketError) {
}
protected SocketException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext) {
GlobalLog.Print("SocketException::.ctor(serialized) " + NativeErrorCode.ToString() + ":" + Message);
}
///
/// [To be supplied.]
///
public override int ErrorCode {
//
// the base class returns the HResult with this property
// we need the Win32 Error Code, hence the override.
//
get {
return NativeErrorCode;
}
}
public override string Message {
get {
// If not null add EndPoint.ToString() to end of base Message
if (m_EndPoint == null) {
return base.Message;
} else {
return base.Message + " " + m_EndPoint.ToString();
}
}
}
public SocketError SocketErrorCode {
//
// the base class returns the HResult with this property
// we need the Win32 Error Code, hence the override.
//
get {
return (SocketError)NativeErrorCode;
}
}
}; // class SocketException
} // namespace System.Net
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InitialServerConnectionReader.cs
- SecurityToken.cs
- WindowsFormsHostPropertyMap.cs
- PostBackTrigger.cs
- TimeoutException.cs
- StorageMappingItemLoader.cs
- XmlSchemaCompilationSettings.cs
- EncryptedPackage.cs
- MarshalByRefObject.cs
- VarInfo.cs
- SimpleWebHandlerParser.cs
- ProviderConnectionPoint.cs
- XPathNode.cs
- ControlCachePolicy.cs
- DeferredTextReference.cs
- BidOverLoads.cs
- ObjectDisposedException.cs
- XmlLoader.cs
- _ChunkParse.cs
- Html32TextWriter.cs
- InputProviderSite.cs
- ApplicationDirectoryMembershipCondition.cs
- InvalidWMPVersionException.cs
- HttpRuntime.cs
- HttpPostedFile.cs
- WebPartDeleteVerb.cs
- FormatException.cs
- AspNetCompatibilityRequirementsAttribute.cs
- UICuesEvent.cs
- DecimalFormatter.cs
- InternalUserCancelledException.cs
- SystemMulticastIPAddressInformation.cs
- CallbackHandler.cs
- TabletDeviceInfo.cs
- MapPathBasedVirtualPathProvider.cs
- SecurityContext.cs
- HelpKeywordAttribute.cs
- SQLBytesStorage.cs
- InvokePattern.cs
- HtmlTitle.cs
- BamlVersionHeader.cs
- Empty.cs
- CodeConditionStatement.cs
- ContextStack.cs
- MemoryMappedViewStream.cs
- RelationshipEndCollection.cs
- TypeForwardedToAttribute.cs
- DecimalAverageAggregationOperator.cs
- DoubleCollection.cs
- MetaData.cs
- DefaultObjectSerializer.cs
- CodeExpressionStatement.cs
- Zone.cs
- cookieexception.cs
- Domain.cs
- XmlILCommand.cs
- HttpServerVarsCollection.cs
- ViewGenResults.cs
- ProtocolsConfigurationHandler.cs
- EncryptedType.cs
- NameValueConfigurationElement.cs
- Inflater.cs
- AsyncPostBackTrigger.cs
- OdbcConnectionString.cs
- InputScopeConverter.cs
- SemanticValue.cs
- MouseDevice.cs
- EFAssociationProvider.cs
- TdsParser.cs
- ComponentChangingEvent.cs
- GradientSpreadMethodValidation.cs
- EntityClassGenerator.cs
- StrokeNodeOperations.cs
- NativeCompoundFileAPIs.cs
- XmlSchemaAttribute.cs
- IInstanceTable.cs
- StyleXamlParser.cs
- List.cs
- ViewEventArgs.cs
- BuildProvidersCompiler.cs
- NotImplementedException.cs
- MessageBox.cs
- ManipulationInertiaStartingEventArgs.cs
- LinqTreeNodeEvaluator.cs
- MaskedTextProvider.cs
- EntityContainerAssociationSetEnd.cs
- CursorInteropHelper.cs
- Terminate.cs
- FileLoadException.cs
- SponsorHelper.cs
- PreviewKeyDownEventArgs.cs
- XmlAnyElementAttributes.cs
- _Rfc2616CacheValidators.cs
- Types.cs
- SplitterPanel.cs
- SqlDependencyUtils.cs
- ChannelBinding.cs
- QuaternionRotation3D.cs
- ObjectDataSourceMethodEditor.cs
- ClientBuildManager.cs