Socket.IOControl メソッド (IOControlCode, Byte[], Byte[])
アセンブリ: 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, array<unsigned char>^ optionInValue, array<unsigned char>^ optionOutValue )
public function IOControl ( ioControlCode : IOControlCode, optionInValue : byte[], optionOutValue : byte[] ) : int
戻り値
optionOutValue パラメータのバイト数。


このメソッドは、Socket クラスの現在のインスタンスの基になるオペレーティング システム Socket への低水準アクセスを提供します。詳細については、MSDN ライブラリで WSAIoctl のドキュメントを参照してください。
![]() |
---|
SocketException が発生した場合は、SocketException.ErrorCode プロパティを使用して具体的なエラー コードを取得してください。このコードを取得したら、Windows Socket Version 2 API エラー コードのドキュメントでエラーの詳細情報を確認してください。これは MSDN ライブラリから入手できます。 |

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

- SecurityPermission (アンマネージ コードを実行するために必要なアクセス許可)。UnmanagedCode (関連する列挙体)

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


Socket.IOControl メソッド (Int32, Byte[], Byte[])
アセンブリ: 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, array<unsigned char>^ optionInValue, array<unsigned char>^ optionOutValue )
public function IOControl ( ioControlCode : int, optionInValue : byte[], optionOutValue : byte[] ) : int
戻り値
optionOutValue パラメータのバイト数。


IOControl メソッドは、Socket クラスの現在のインスタンスの基になるオペレーティング システム Socket への低レベル アクセスを提供します。詳細については、MSDN ライブラリで WSAIoctl のドキュメントを参照してください。
![]() |
---|
SocketException が発生した場合は、SocketException.ErrorCode プロパティを使用して具体的なエラー コードを取得してください。このコードを取得したら、Windows Socket Version 2 API エラー コードのドキュメントでエラーの詳細情報を確認してください。これは MSDN ライブラリから入手できます。 |

次に示すのは、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

- SecurityPermission (アンマネージ コードを実行するために必要なアクセス許可)。UnmanagedCode (関連する列挙体)

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Socket.IOControl メソッド
Weblioに収録されているすべての辞書からSocket.IOControlを検索する場合は、下記のリンクをクリックしてください。

- Socket.IOControlのページへのリンク