Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / SocketException.cs / 1 / 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
// 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.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
// 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
- XmlSchemaObjectTable.cs
- PointLightBase.cs
- Popup.cs
- SmiSettersStream.cs
- ReferenceConverter.cs
- SuppressIldasmAttribute.cs
- CrossAppDomainChannel.cs
- OperatorExpressions.cs
- PeerSecurityHelpers.cs
- base64Transforms.cs
- OdbcReferenceCollection.cs
- CalendarButton.cs
- ControlCachePolicy.cs
- ComponentCollection.cs
- DropShadowBitmapEffect.cs
- TypeInitializationException.cs
- ProvidersHelper.cs
- MenuEventArgs.cs
- TableAdapterManagerHelper.cs
- ResourceDefaultValueAttribute.cs
- CodeChecksumPragma.cs
- ProfileSettingsCollection.cs
- SignedXml.cs
- ResourceBinder.cs
- ColorAnimation.cs
- VerbConverter.cs
- TextEditorTables.cs
- TabControl.cs
- XmlNodeComparer.cs
- PeerInputChannelListener.cs
- HttpListenerRequest.cs
- XmlSchemas.cs
- ValidatingPropertiesEventArgs.cs
- SByteConverter.cs
- EntityClientCacheEntry.cs
- Variant.cs
- ObjectPersistData.cs
- cookiecollection.cs
- Vector3DCollectionConverter.cs
- CheckBoxAutomationPeer.cs
- GridViewHeaderRowPresenter.cs
- WeakReferenceList.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- EventProxy.cs
- COM2TypeInfoProcessor.cs
- DesignBindingEditor.cs
- DemultiplexingClientMessageFormatter.cs
- SQLBoolean.cs
- OrderByQueryOptionExpression.cs
- TextViewSelectionProcessor.cs
- XmlCollation.cs
- SqlReferenceCollection.cs
- Point.cs
- XmlSchemaAnyAttribute.cs
- StatusBar.cs
- ArrayEditor.cs
- WindowsTitleBar.cs
- precedingquery.cs
- InheritablePropertyChangeInfo.cs
- SessionIDManager.cs
- PeerChannelFactory.cs
- GrammarBuilderPhrase.cs
- XmlTextReaderImplHelpers.cs
- JsonEncodingStreamWrapper.cs
- XmlSchemaCollection.cs
- PropagatorResult.cs
- WebBrowserUriTypeConverter.cs
- TextSelectionProcessor.cs
- SafeSecurityHelper.cs
- OleDbWrapper.cs
- DurableEnlistmentState.cs
- DrawingAttributesDefaultValueFactory.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- ExpressionEditor.cs
- OleDbPermission.cs
- SerializationEventsCache.cs
- ProjectionPathBuilder.cs
- HttpWebResponse.cs
- linebase.cs
- TextClipboardData.cs
- _UriSyntax.cs
- _NetworkingPerfCounters.cs
- Int32.cs
- SyndicationCategory.cs
- CompositeKey.cs
- Utils.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- ContextMenuStripActionList.cs
- InstanceCreationEditor.cs
- HealthMonitoringSection.cs
- XmlAnyElementAttributes.cs
- UnsafeNativeMethods.cs
- RequestUriProcessor.cs
- FormatException.cs
- ObjectAnimationBase.cs
- _TLSstream.cs
- baseshape.cs
- CryptoProvider.cs
- GradientSpreadMethodValidation.cs
- EntityConnectionStringBuilder.cs