This documentation is archived and is not being maintained.

LingerOption.LingerTime Property

Gets or sets the amount of time to remain connected after calling the Socket.Close method if data remains to be sent.

[Visual Basic]
Public Property LingerTime As Integer
public int LingerTime {get; set;}
public: __property int get_LingerTime();
public: __property void set_LingerTime(int);
public function get LingerTime() : int;
public function set LingerTime(int);

Property Value

The amount of time, in seconds, to remain connected after calling Socket.Close.


Use this value if you want to determine how long a closed Socket will attempt transferring unsent data before timing out. You can also set this value to the desired time-out period, in seconds. If the Enabled property is true, and you set LingerTime to 0, the Socket will attempt to send data until there is no data left in the outgoing network buffer. If you change this value, you must pass the altered LingerOption to the SetSocketOption or LingerState method.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

LingerOption Class | LingerOption Members | System.Net.Sockets Namespace