The Labs \ Source Viewer \ SSCLI \ System.Net.Sockets \ SocketError

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SocketErrors.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Net.Sockets
  16. {
  17.     using System;
  18.     using System.Net;
  19.    
  20.     /// <devdoc>
  21.     /// <para>
  22.     /// Defines socket error constants.
  23.     /// </para>
  24.     /// </devdoc>
  25.    
  26.    
  27.     public enum SocketError : int
  28.     {
  29.         /// <devdoc>
  30.         /// <para>
  31.         /// The operation completed succesfully.
  32.         /// </para>
  33.         /// </devdoc>
  34.         Success = 0,
  35.        
  36.         /// <devdoc>
  37.         /// <para>
  38.         /// The socket has an error.
  39.         /// </para>
  40.         /// </devdoc>
  41.         SocketError = (-1),
  42.        
  43.        
  44. /*
  45.         * All Windows Sockets error constants are biased by WSABASEERR from
  46.         * the "normal"
  47.         */       
  48.         /// <devdoc>
  49.         /// <para>
  50.         /// The base value of all socket error constants. All other socket errors are
  51.         /// offset from this value.
  52.         /// </para>
  53.         /// </devdoc>
  54.        
  55.        
  56.         ///WSABASEERR = 10000;
  57.        
  58. /*
  59.         * Windows Sockets definitions of regular Microsoft C error constants
  60.         */       
  61.         /// <devdoc>
  62.         /// <para>
  63.         /// A blocking socket call was canceled.
  64.         /// </para>
  65.         /// </devdoc>
  66.         Interrupted = (10000 + 4),
  67.         //WSAEINTR
  68.         /// <devdoc>
  69.         /// <para>
  70.         /// [To be supplied.]
  71.         /// </para>
  72.         /// </devdoc>
  73.         //WSAEBADF = (10000+9), //
  74.         /// <devdoc>
  75.         /// <para>
  76.         /// Permission denied.
  77.         /// </para>
  78.         /// </devdoc>
  79.         AccessDenied = (10000 + 13),
  80.         //WSAEACCES
  81.         /// <devdoc>
  82.         /// <para>
  83.         /// Bad address.
  84.         /// </para>
  85.         /// </devdoc>
  86.         Fault = (10000 + 14),
  87.         //WSAEFAULT
  88.         /// <devdoc>
  89.         /// <para>
  90.         /// Invalid argument.
  91.         /// </para>
  92.         /// </devdoc>
  93.         InvalidArgument = (10000 + 22),
  94.         //WSAEINVAL
  95.         /// <devdoc>
  96.         /// <para>
  97.         /// Too many open
  98.         /// files.
  99.         /// </para>
  100.         /// </devdoc>
  101.         TooManyOpenSockets = (10000 + 24),
  102.         //WSAEMFILE
  103.        
  104. /*
  105.         * Windows Sockets definitions of regular Berkeley error constants
  106.         */       
  107.         /// <devdoc>
  108.         /// <para>
  109.         /// Resource temporarily unavailable.
  110.         /// </para>
  111.         /// </devdoc>
  112.         WouldBlock = (10000 + 35),
  113.         //WSAEWOULDBLOCK
  114.         /// <devdoc>
  115.         /// <para>
  116.         /// Operation now in progress.
  117.         /// </para>
  118.         /// </devdoc>
  119.         InProgress = (10000 + 36),
  120.         // WSAEINPROGRESS
  121.         /// <devdoc>
  122.         /// <para>
  123.         /// Operation already in progress.
  124.         /// </para>
  125.         /// </devdoc>
  126.         AlreadyInProgress = (10000 + 37),
  127.         //WSAEALREADY
  128.         /// <devdoc>
  129.         /// <para>
  130.         /// Socket operation on nonsocket.
  131.         /// </para>
  132.         /// </devdoc>
  133.         NotSocket = (10000 + 38),
  134.         //WSAENOTSOCK
  135.         /// <devdoc>
  136.         /// <para>
  137.         /// Destination address required.
  138.         /// </para>
  139.         /// </devdoc>
  140.         DestinationAddressRequired = (10000 + 39),
  141.         //WSAEDESTADDRREQ
  142.         /// <devdoc>
  143.         /// <para>
  144.         /// Message too long.
  145.         /// </para>
  146.         /// </devdoc>
  147.         MessageSize = (10000 + 40),
  148.         ProtocolType = (10000 + 41),
  149.         //WSAEPROTOTYPE
  150.         /// <devdoc>
  151.         /// <para>
  152.         /// Bad protocol option.
  153.         /// </para>
  154.         /// </devdoc>
  155.         ProtocolOption = (10000 + 42),
  156.         //WSAENOPROTOOPT
  157.         /// <devdoc>
  158.         /// <para>
  159.         /// Protocol not supported.
  160.         /// </para>
  161.         /// </devdoc>
  162.         ProtocolNotSupported = (10000 + 43),
  163.         //WSAEPROTONOSUPPORT
  164.         /// <devdoc>
  165.         /// <para>
  166.         /// Socket type not supported.
  167.         /// </para>
  168.         /// </devdoc>
  169.         SocketNotSupported = (10000 + 44),
  170.         //WSAESOCKTNOSUPPORT
  171.         /// <devdoc>
  172.         /// <para>
  173.         /// Operation not supported.
  174.         /// </para>
  175.         /// </devdoc>
  176.         OperationNotSupported = (10000 + 45),
  177.         //WSAEOPNOTSUPP
  178.         /// <devdoc>
  179.         /// <para>
  180.         /// Protocol family not supported.
  181.         /// </para>
  182.         /// </devdoc>
  183.         ProtocolFamilyNotSupported = (10000 + 46),
  184.         //WSAEPFNOSUPPORT
  185.         /// <devdoc>
  186.         /// <para>
  187.         /// Address family not supported by protocol family.
  188.         /// </para>
  189.         /// </devdoc>
  190.         AddressFamilyNotSupported = (10000 + 47),
  191.         //WSAEAFNOSUPPORT
  192.         /// <devdoc>
  193.         /// Address already in use.
  194.         /// </devdoc>
  195.         AddressAlreadyInUse = (10000 + 48),
  196.         // WSAEADDRINUSE
  197.         /// <devdoc>
  198.         /// <para>
  199.         /// Cannot assign requested address.
  200.         /// </para>
  201.         /// </devdoc>
  202.         AddressNotAvailable = (10000 + 49),
  203.         //WSAEADDRNOTAVAIL
  204.         /// <devdoc>
  205.         /// <para>
  206.         /// Network is down.
  207.         /// </para>
  208.         /// </devdoc>
  209.         NetworkDown = (10000 + 50),
  210.         //WSAENETDOWN
  211.         /// <devdoc>
  212.         /// <para>
  213.         /// Network is unreachable.
  214.         /// </para>
  215.         /// </devdoc>
  216.         NetworkUnreachable = (10000 + 51),
  217.         //WSAENETUNREACH
  218.         /// <devdoc>
  219.         /// <para>
  220.         /// Network dropped connection on reset.
  221.         /// </para>
  222.         /// </devdoc>
  223.         NetworkReset = (10000 + 52),
  224.         //WSAENETRESET
  225.         /// <devdoc>
  226.         /// <para>
  227.         /// Software caused connection to abort.
  228.         /// </para>
  229.         /// </devdoc>
  230.         ConnectionAborted = (10000 + 53),
  231.         //WSAECONNABORTED
  232.         /// <devdoc>
  233.         /// <para>
  234.         /// Connection reset by peer.
  235.         /// </para>
  236.         /// </devdoc>
  237.         ConnectionReset = (10000 + 54),
  238.         //WSAECONNRESET
  239.         /// <devdoc>
  240.         /// No buffer space available.
  241.         /// </devdoc>
  242.         NoBufferSpaceAvailable = (10000 + 55),
  243.         //WSAENOBUFS
  244.         /// <devdoc>
  245.         /// <para>
  246.         /// Socket is already connected.
  247.         /// </para>
  248.         /// </devdoc>
  249.         IsConnected = (10000 + 56),
  250.         //WSAEISCONN
  251.         /// <devdoc>
  252.         /// <para>
  253.         /// Socket is not connected.
  254.         /// </para>
  255.         /// </devdoc>
  256.         NotConnected = (10000 + 57),
  257.         //WSAENOTCONN
  258.         /// <devdoc>
  259.         /// <para>
  260.         /// Cannot send after socket shutdown.
  261.         /// </para>
  262.         /// </devdoc>
  263.         Shutdown = (10000 + 58),
  264.         //WSAESHUTDOWN
  265.         /// <devdoc>
  266.         /// <para>
  267.         /// [To be supplied.]
  268.         /// </para>
  269.         /// </devdoc>
  270.         // WSAETOOMANYREFS = (10000+59), //WSAETOOMANYREFS
  271.         /// <devdoc>
  272.         /// <para>
  273.         /// Connection timed out.
  274.         /// </para>
  275.         /// </devdoc>
  276.         TimedOut = (10000 + 60),
  277.         //WSAETIMEDOUT
  278.         /// <devdoc>
  279.         /// <para>
  280.         /// Connection refused.
  281.         /// </para>
  282.         /// </devdoc>
  283.         ConnectionRefused = (10000 + 61),
  284.         //WSAECONNREFUSED
  285.         /// <devdoc>
  286.         /// <para>
  287.         /// [To be supplied.]
  288.         /// </para>
  289.         /// </devdoc>
  290.         // WSAELOOP = (10000+62),
  291.         /// <devdoc>
  292.         /// <para>
  293.         /// [To be supplied.]
  294.         /// </para>
  295.         /// </devdoc>
  296.         // WSAENAMETOOLONG = (10000+63),
  297.         /// <devdoc>
  298.         /// <para>
  299.         /// Host is down.
  300.         /// </para>
  301.         /// </devdoc>
  302.         HostDown = (10000 + 64),
  303.         //WSAEHOSTDOWN
  304.         /// <devdoc>
  305.         /// <para>
  306.         /// No route to host.
  307.         /// </para>
  308.         /// </devdoc>
  309.         HostUnreachable = (10000 + 65),
  310.         //WSAEHOSTUNREACH
  311.         /// <devdoc>
  312.         /// <para>
  313.         /// [To be supplied.]
  314.         /// </para>
  315.         /// </devdoc>
  316.         // WSAENOTEMPTY = (10000+66),
  317.         /// <devdoc>
  318.         /// <para>
  319.         /// Too many processes.
  320.         /// </para>
  321.         /// </devdoc>
  322.         ProcessLimit = (10000 + 67),
  323.         //WSAEPROCLIM
  324.         /// <devdoc>
  325.         /// <para>
  326.         /// [To be supplied.]
  327.         /// </para>
  328.         /// </devdoc>
  329.         // WSAEUSERS = (10000+68),
  330.         /// <devdoc>
  331.         /// <para>
  332.         /// [To be supplied.]
  333.         /// </para>
  334.         /// </devdoc>
  335.         // WSAEDQUOT = (10000+69),
  336.         /// <devdoc>
  337.         /// <para>
  338.         /// [To be supplied.]
  339.         /// </para>
  340.         /// </devdoc>
  341.         // WSAESTALE = (10000+70),
  342.         /// <devdoc>
  343.         /// <para>
  344.         /// [To be supplied.]
  345.         /// </para>
  346.         /// </devdoc>
  347. /*
  348.         * Extended Windows Sockets error constant definitions
  349.         */        /// <devdoc>
  350.         /// <para>
  351.         /// Network subsystem is unavailable.
  352.         /// </para>
  353.         /// </devdoc>
  354.         SystemNotReady = (10000 + 91),
  355.         //WSASYSNOTREADY
  356.         /// <devdoc>
  357.         /// <para>
  358.         /// Winsock.dll out of range.
  359.         /// </para>
  360.         /// </devdoc>
  361.         VersionNotSupported = (10000 + 92),
  362.         //WSAVERNOTSUPPORTED
  363.         /// <devdoc>
  364.         /// <para>
  365.         /// Successful startup not yet performed.
  366.         /// </para>
  367.         /// </devdoc>
  368.         NotInitialized = (10000 + 93),
  369.         //WSANOTINITIALISED
  370.        
  371.         // WSAEREMOTE = (10000+71),
  372.         /// <devdoc>
  373.         /// <para>
  374.         /// Graceful shutdown in progress.
  375.         /// </para>
  376.         /// </devdoc>
  377.         Disconnecting = (10000 + 101),
  378.         //WSAEDISCON
  379.        
  380.         TypeNotFound = (10000 + 109),
  381.         //WSATYPE_NOT_FOUND
  382.        
  383. /*
  384.         * Error return codes from gethostbyname() and gethostbyaddr()
  385.         *              = (when using the resolver). Note that these errors are
  386.         * retrieved via WSAGetLastError() and must therefore follow
  387.         * the rules for avoiding clashes with error numbers from
  388.         * specific implementations or language run-time systems.
  389.         * For this reason the codes are based at 10000+1001.
  390.         * Note also that [WSA]NO_ADDRESS is defined only for
  391.         * compatibility purposes.
  392.         */       
  393.        
  394.        
  395.        
  396.         /// <devdoc>
  397.         /// <para>
  398.         /// Host not found (Authoritative Answer: Host not found).
  399.         /// </para>
  400.         /// </devdoc>
  401.         HostNotFound = (10000 + 1001),
  402.         //WSAHOST_NOT_FOUND
  403.         /// <devdoc>
  404.         /// <para>
  405.         /// Nonauthoritative host not found (Non-Authoritative: Host not found, or SERVERFAIL).
  406.         /// </para>
  407.         /// </devdoc>
  408.         TryAgain = (10000 + 1002),
  409.         //WSATRY_AGAIN
  410.         /// <devdoc>
  411.         /// <para>
  412.         /// This is a nonrecoverable error (Non recoverable errors, FORMERR, REFUSED, NOTIMP).
  413.         /// </para>
  414.         /// </devdoc>
  415.         NoRecovery = (10000 + 1003),
  416.         //WSANO_RECOVERY
  417.         /// <devdoc>
  418.         /// <para>
  419.         /// Valid name, no data record of requested type.
  420.         /// </para>
  421.         /// </devdoc>
  422.         NoData = (10000 + 1004),
  423.         //WSANO_DATA
  424.        
  425.        
  426.         //OS dependent errors
  427.        
  428.         /// <devdoc>
  429.         /// <para>
  430.         /// Overlapped operations will complete later.
  431.         /// </para>
  432.         /// </devdoc>
  433.         IOPending = (int)UnsafeNclNativeMethods.ErrorCodes.ERROR_IO_PENDING,
  434.         // 997
  435.         /// <devdoc>
  436.         /// <para>
  437.         /// [To be supplied.]
  438.         /// </para>
  439.         /// </devdoc>
  440.         OperationAborted = (int)UnsafeNclNativeMethods.ErrorCodes.ERROR_OPERATION_ABORTED
  441.         // 995, WSA_OPERATION_ABORTED
  442.     }
  443. }

Developer Fusion