Mono Class Library: System.Net.Sockets Namespace

System.Net.Sockets.LingerOption Class

Maintains information that specifies how a System.Net.Sockets.Socket instance with pending data behaves when the Socket.Close method of the socket is called. [Edit]

See Also: LingerOption Members

public class LingerOption

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

An instance of this class is passed into the Socket.SetSocketOption(SocketOptionLevel, SocketOptionName, int) method and is returned by the Socket.GetSocketOption(SocketOptionLevel, SocketOptionName) method when the optionName parameter is set to SocketOptionName.Linger.

When the LingerOption.Enabled property is true, any queued data continues to be sent until time equal to the setting of the LingerOption.LingerTime property has passed or until the input queue is empty. At this time, the connection is closed.

When the LingerOption.LingerTime property is zero or the LingerOption.Enabled property is false, calling Socket.Close immediately closes the socket and any pending data is lost.

When setting the SocketOptionName.Linger option of an instance of the System.Net.Sockets.Socket class, a ArgumentException exception is thrown if the LingerOption.LingerTime property is less than zero or greater than ushort.MaxValue. [Edit]

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.x.x, 1.0.5000.0, 2.0.0.0