TcpClient.LingerState プロパティ
アセンブリ: System (system.dll 内)

Dim instance As TcpClient Dim value As LingerOption value = instance.LingerState instance.LingerState = value
public: property LingerOption^ LingerState { LingerOption^ get (); void set (LingerOption^ value); }
/** @property */ public LingerOption get_LingerState () /** @property */ public void set_LingerState (LingerOption value)
public function get LingerState () : LingerOption public function set LingerState (value : LingerOption)
LingerOption。既定では、接続の待機は無効です。

このプロパティは、送信するデータが残っている場合に、Close を呼び出した後で TCP 接続を維持する時間の長さを制御します。Write メソッドを呼び出すと、データは発信ネットワーク バッファに置かれます。このプロパティを使用すると、Close メソッドが接続を無効にする前にリモート ホストにこのデータを送信できます。
接続の待機を有効にするには、必要な値を格納する LingerOption を作成し、LingerOption にこのプロパティを設定します。LingerOption の Enabled プロパティが true の場合、LingerOption.LingerTime 秒間のタイムアウトでネットワークにデータが送信されます。データが送信されるか、タイムアウトが経過すると、接続が終了し、未送信のデータは失われます。LingerOption の Enabled プロパティが false の場合、送信するデータが残っていても、Close メソッドを呼び出した直後に接続は終了します。

' Sets the amount of time to linger after closing, using the LingerOption public property. Dim lingerOption As New LingerOption(True, 10) tcpClient.LingerState = lingerOption ' Gets the amount of linger time set, using the LingerOption public property. If tcpClient.LingerState.LingerTime = 10 Then Console.WriteLine(("The linger state setting was successfully set to " + tcpClient.LingerState.LingerTime.ToString())) End If
// sets the amount of time to linger after closing, using the LingerOption public property. LingerOption lingerOption = new LingerOption (true, 10); tcpClient.LingerState = lingerOption; // gets the amount of linger time set, using the LingerOption public property. if (tcpClient.LingerState.LingerTime == 10) Console.WriteLine ("The linger state setting was successfully set to " + tcpClient.LingerState.LingerTime.ToString ());
// sets the amount of time to linger after closing, using the LingerOption public property. LingerOption^ lingerOption = gcnew LingerOption( true,10 ); tcpClient->LingerState = lingerOption; // gets the amount of linger time set, using the LingerOption public property. if ( tcpClient->LingerState->LingerTime == 10 ) Console::WriteLine( "The linger state setting was successfully set to {0}", tcpClient->LingerState->LingerTime );
// sets the amount of time to linger after closing, using the // LingerOption public property. LingerOption lingerOption = new LingerOption(true, 10); tcpClient.set_LingerState(lingerOption); // gets the amount of linger time set, using the LingerOption public // property. if (tcpClient.get_LingerState().get_LingerTime() == 10) { Console.WriteLine("The linger state setting was successfully set to " + ((Int32)tcpClient.get_LingerState().get_LingerTime()).ToString()); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTcpClient.LingerState プロパティを検索する場合は、下記のリンクをクリックしてください。

- TcpClient.LingerState プロパティのページへのリンク