LingerOption.LingerTime プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > LingerOption.LingerTime プロパティの意味・解説 

LingerOption.LingerTime プロパティ

送信するデータ残っている場合に、Socket.Close メソッド呼び出した後で接続維持する時間取得または設定します

名前空間: System.Net.Sockets
アセンブリ: System (system.dll 内)
構文構文

Dim instance As LingerOption
Dim value As Integer

value = instance.LingerTime

instance.LingerTime = value
public int LingerTime { get;
 set; }
public:
property int LingerTime {
    int get ();
    void set (int value);
}
/** @property */
public int get_LingerTime ()

/** @property */
public void set_LingerTime (int
 value)
public function get LingerTime
 () : int

public function set LingerTime
 (value : int)

プロパティ
Socket.Close呼び出された後、接続維持する秒数。

解説解説
使用例使用例

このプロパティの値を表示する例を次に示します

    Console.WriteLine(("This application will timeout if Send does
 not return within " + Encoding.ASCII.GetString(s.GetSocketOption(SocketOptionLevel.Socket,
 SocketOptionName.SendTimeout, 4))))
    ' blocks until send returns
    Dim i As Integer = s.Send(msg)

    ' blocks until read returns
    Dim bytes(1024) As Byte
    s.Receive(bytes)

    'Display to the screen
    Console.WriteLine(Encoding.ASCII.GetString(bytes))
    s.Shutdown(SocketShutdown.Both)

    Console.WriteLine(("If data remains to be sent, this application
 will stay open for " + CType(s.GetSocketOption(SocketOptionLevel.Socket,
 SocketOptionName.Linger), LingerOption).LingerTime.ToString()))
    s.Close()
End Sub 'SetSocketOptions
Console.WriteLine ("This application will timeout if Send
 does not return within " + Encoding.ASCII.GetString (s.GetSocketOption
 (SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 4)));

// blocks until send returns
int i = s.Send (msg);

// blocks until read returns
byte[] bytes = new byte[1024];

s.Receive (bytes);

//Display to the screen
Console.WriteLine (Encoding.ASCII.GetString (bytes));
s.Shutdown (SocketShutdown.Both);
Console.WriteLine ("If data remains to be sent, this application
 will stay open for " + ((LingerOption)s.GetSocketOption
 (SocketOptionLevel.Socket, SocketOptionName.Linger)).LingerTime.ToString ());
s.Close ();
Console::Write(  "This application will timeout if Send does
 not return within " );
Console::WriteLine( Encoding::ASCII->GetString( s->GetSocketOption( SocketOptionLevel::Socket,
 SocketOptionName::SendTimeout, 4 ) ) );

// Blocks until send returns.
int i = s->Send( msg );

// Blocks until read returns.
array<Byte>^ bytes = gcnew array<Byte>(1024);

s->Receive( bytes );

//Displays to the screen.
Console::WriteLine( Encoding::ASCII->GetString( bytes ) );
s->Shutdown( SocketShutdown::Both );
Console::Write(  "If data remains to be sent, this application
 will stay open for " );
Console::WriteLine( safe_cast<LingerOption^>(s->GetSocketOption( SocketOptionLevel::Socket,
 SocketOptionName::Linger ))->LingerTime.ToString() );
s->Close();
    Console.WriteLine("This application will timeout if Send
 does not "
        + "return within " + Encoding.get_ASCII().GetString(s.
        GetSocketOption(SocketOptionLevel.Socket, 
        SocketOptionName.SendTimeout, 4)));
    // blocks until send returns
    int i = s.Send(msg);
    // blocks until read returns
    ubyte bytes[] = new ubyte[1024];

    s.Receive(bytes);
    //Display to the screen
    Console.WriteLine(Encoding.get_ASCII().GetString(bytes));
    s.Shutdown(SocketShutdown.Both);
    Console.WriteLine("If data remains to be sent, this application
 "
        + "will stay open for " + ((LingerOption)(s.
        GetSocketOption(SocketOptionLevel.Socket, 
        SocketOptionName.Linger))).get_LingerTime());
    s.Close();
} //SetSocketOptions

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LingerOption クラス
LingerOption メンバ
System.Net.Sockets 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「LingerOption.LingerTime プロパティ」の関連用語

LingerOption.LingerTime プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



LingerOption.LingerTime プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS