| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //
- // System.Net.Sockets.LingerOption.cs
- //
- // Author:
- // Andrew Sutton
- //
- // (C) Andrew Sutton
- //
- using System;
- namespace System.Net.Sockets
- {
- // <remarks>
- // Encapsulates a linger option.
- // </remarks>
- public class LingerOption
- {
- protected bool enabled;
- protected int seconds;
- public LingerOption (bool enable, int secs)
- {
- enabled = enable;
- seconds = secs;
- }
- public bool Enabled
- {
- get { return enabled; }
- set { enabled = value; }
- }
- public int LingerTime
- {
- get { return seconds; }
- set { seconds = value; }
- }
- public override bool Equals (object o)
- {
- return (enabled == o.enabled) && (seconds == o.seconds);
- }
- public override int GetHashCode()
- {
- return seconds;
- }
- public string ToString()
- {
- string ret;
- if (enabled) {
- ret = "off";
- }
- else {
- ret = seconds.ToString();
- }
- return ret;
- }
- }
- }
|