Initializes a new instance of the LingerOption class.
Assembly: System (in System.dll)
There may still be data available in the outgoing network buffer after you close the Socket. Use the enable parameter to specify whether you would like the Socket to continue transmitting unsent data after the close method is called. Use the seconds parameter to indicate how long you would like the Socket to attempt transferring unsent data before timing out. If you specify true for the enable parameter and 0 for the seconds parameter, the Socket will attempt to send data until there is no data left in the outgoing network buffer. If you specify false for the enable parameter, the Socket will close immediately and any unsent data will be lost.
The following table describes the behavior on the Socket.Close and TcpClient.Close methods based on the possible values of the enable and seconds parameters when an T:System.Net.Sockets.LingerOption instance is created and set in the Socket.LingerState or TcpClient.LingerState property.
false (disabled), the default value
The time-out is not applicable, (default).
Attempts to send pending data for a connection-oriented socket (TCP, for example) until the default IP protocol time-out expires.
A nonzero time-out
Attempts to send pending data until the specified time-out expires, and if the attempt fails, then Winsock resets the connection.
A zero timeout.
Discards any pending data. For connection-oriented socket (TCP, for example), Winsock resets the connection.
The IP stack computes the default IP protocol time-out period to use based on the round trip time of the connection. In most cases, the time-out computed by the stack is more relevant than one defined by an application. This is the default behavior for a socket when the LingerState property is not set.