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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="LingerOption.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.    
  19.    
  20.     /// <devdoc>
  21.     /// <para>Contains information for a socket's linger time, the amount of time it will
  22.     /// remain after closing if data remains to be sent.</para>
  23.     /// </devdoc>
  24.     public class LingerOption
  25.     {
  26.         bool enabled;
  27.         int lingerTime;
  28.        
  29.         /// <devdoc>
  30.         /// <para>
  31.         /// Initializes a new instance of the <see cref='Sockets.LingerOption'/> class.
  32.         /// </para>
  33.         /// </devdoc>
  34.         public LingerOption(bool enable, int seconds)
  35.         {
  36.             Enabled = enable;
  37.             LingerTime = seconds;
  38.         }
  39.        
  40.         /// <devdoc>
  41.         /// <para>
  42.         /// Enables or disables lingering after
  43.         /// close.
  44.         /// </para>
  45.         /// </devdoc>
  46.         public bool Enabled {
  47.             get { return enabled; }
  48.             set { enabled = value; }
  49.         }
  50.        
  51.         /// <devdoc>
  52.         /// <para>
  53.         /// The amount of time, in seconds, to remain connected after a close.
  54.         /// </para>
  55.         /// </devdoc>
  56.         public int LingerTime {
  57.             get { return lingerTime; }
  58.             set { lingerTime = value; }
  59.         }
  60.        
  61.     }
  62.     // class LingerOption
  63. }
  64. // namespace System.Net.Sockets

Developer Fusion