Socket.IOControlとは? わかりやすく解説

Socket.IOControl メソッド (IOControlCode, Byte[], Byte[])

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

IOControlCode 列挙体を使用して制御コード指定しSocket の低水準操作モード設定します

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

Public Function IOControl ( _
    ioControlCode As IOControlCode, _
    optionInValue As Byte(), _
    optionOutValue As Byte() _
) As Integer
Dim instance As Socket
Dim ioControlCode As IOControlCode
Dim optionInValue As Byte()
Dim optionOutValue As Byte()
Dim returnValue As Integer

returnValue = instance.IOControl(ioControlCode, optionInValue, optionOutValue)
public int IOControl (
    IOControlCode ioControlCode,
    byte[] optionInValue,
    byte[] optionOutValue
)
public:
int IOControl (
    IOControlCode ioControlCode, 
    array<unsigned char>^ optionInValue, 
    array<unsigned char>^ optionOutValue
)
public int IOControl (
    IOControlCode ioControlCode, 
    byte[] optionInValue, 
    byte[] optionOutValue
)
public function IOControl (
    ioControlCode : IOControlCode, 
    optionInValue : byte[], 
    optionOutValue : byte[]
) : int

パラメータ

ioControlCode

実行する演算制御コード指定する IOControlCode 値。

optionInValue

演算必要な入力データ格納する Byte 型の配列

optionOutValue

演算によって返され出力データ格納する Byte 型の配列

戻り値
optionOutValue パラメータバイト数。

例外例外
解説解説
使用例使用例

DataToRead を使用して IOControl呼び出した場合と、Available プロパティ使用した場合とを比較するコード例次に示します

static void DisplayPendingByteCount(Socket
 s)
{
    byte[] outValue = BitConverter.GetBytes(0);

    // Check how many bytes have been received.
    s.IOControl(IOControlCode.DataToRead, null, outValue);

    uint bytesAvailable = BitConverter.ToUInt32(outValue, 0);
    Console.Write("server has {0} bytes pending. ", 
        bytesAvailable);
    Console.WriteLine("Available property says {1}.",
                     s.Available);

    return;
}
void DisplayPendingByteCount( Socket^ s )
{
   array<Byte>^ outValue = BitConverter::GetBytes( 0 );
   
   // Check how many bytes have been received.
   s->IOControl( IOControlCode::DataToRead, nullptr, outValue );

   UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 );
   Console::Write( "server has {0} bytes pending,",
      bytesAvailable );
   Console::WriteLine( "Available property says {1}.",
      s->Available );
   return;
}
static void DisplayPendingByteCount(Socket
 s)
{
    ubyte outValue[] = BitConverter.GetBytes(0);
    // Check how many bytes have been received.
    s.IOControl(IOControlCode.DataToRead, null, outValue);
    UInt32 bytesAvailable = BitConverter.ToUInt32(outValue, 0);
    //ToDo: Unsigned Integers not supported- converted to int
    Console.Write("server has {0} bytes pending. ",
        bytesAvailable.ToString());
    Console.WriteLine("Available property says {1}.", 
        (System.Int32)s.get_Available());
    return;
} //DisplayPendingByteCount
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Socket.IOControl メソッド (Int32, Byte[], Byte[])

数値制御コード使用してSocket の低水準操作モード設定します

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

Public Function IOControl ( _
    ioControlCode As Integer, _
    optionInValue As Byte(), _
    optionOutValue As Byte() _
) As Integer
Dim instance As Socket
Dim ioControlCode As Integer
Dim optionInValue As Byte()
Dim optionOutValue As Byte()
Dim returnValue As Integer

returnValue = instance.IOControl(ioControlCode, optionInValue, optionOutValue)
public int IOControl (
    int ioControlCode,
    byte[] optionInValue,
    byte[] optionOutValue
)
public:
int IOControl (
    int ioControlCode, 
    array<unsigned char>^ optionInValue, 
    array<unsigned char>^ optionOutValue
)
public int IOControl (
    int ioControlCode, 
    byte[] optionInValue, 
    byte[] optionOutValue
)
public function IOControl (
    ioControlCode : int, 
    optionInValue : byte[], 
    optionOutValue : byte[]
) : int

パラメータ

ioControlCode

実行する演算制御コード指定する Int32 値。

optionInValue

演算必要な入力データ格納する Byte 配列

optionOutValue

演算によって返され出力データ格納する Byte 配列

戻り値
optionOutValue パラメータバイト数。

例外例外
解説解説
使用例使用例

次に示すのは、FIONREAD を使用した場合Available プロパティ使用した場合結果比較するコード例です。

 // FIONREAD is also available as the "Available" property.
public const int FIONREAD
   = 0x4004667F;

static void DisplayPendingByteCount(Socket
 s)
 {
     byte[] outValue = BitConverter.GetBytes(0);

     // Check how many bytes have been received.
     s.IOControl(FIONREAD, null, outValue);
     
     uint bytesAvailable = BitConverter.ToUInt32(outValue, 0);
     Console.WriteLine("server has {0} bytes pending. Available property says
 {1}.",
         bytesAvailable, s.Available);
     
     return;
 }
// FIONREAD is also available as the "Available" property.
const int FIONREAD = 0x4004667F;

void DisplayPendingByteCount( Socket^ s )
{
   array<Byte>^ outValue = BitConverter::GetBytes( 0 );
   
   // Check how many bytes have been received.
   s->IOControl( FIONREAD, nullptr, outValue );

   UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 );
   Console::WriteLine( "server has {0} bytes pending. Available property says
 {1}.",
      bytesAvailable, s->Available );

   return;
}
// FIONREAD is also available as the "Available" property.
public static final int
 FIONREAD = 0x4004667F;

static void DisplayPendingByteCount(Socket
 s)
{
    ubyte outValue[] = BitConverter.GetBytes(0);
    // Check how many bytes have been received.
    s.IOControl(FIONREAD, null, outValue);

    UInt32 bytesAvailable = BitConverter.ToUInt32(outValue, 0);
    //ToDo: Unsigned Integers not supported- converted to int
    Console.WriteLine("server has {0} bytes pending. Available property "
        + "says {1}.", bytesAvailable.ToString(), 
        (System.Int32)s.get_Available());
    return;
} //DisplayPendingByteCount
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Socket.IOControl メソッド



このページでは「.NET Framework クラス ライブラリ リファレンス」からSocket.IOControlを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSocket.IOControlを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSocket.IOControl を検索

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

辞書ショートカット

すべての辞書の索引

「Socket.IOControl」の関連用語

Socket.IOControlのお隣キーワード
検索ランキング

   

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



Socket.IOControlのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS