Socket.IOControl 메서드

정의

Socket의 하위 수준 운영 모드를 설정합니다.

오버로드

IOControl(Int32, Byte[], Byte[])

숫자 컨트롤 코드를 사용하여 Socket의 하위 수준 운영 모드를 설정합니다.

IOControl(IOControlCode, Byte[], Byte[])

Socket 열거형으로 컨트롤 코드를 지정하여 IOControlCode의 하위 수준 운영 모드를 설정합니다.

IOControl(Int32, Byte[], Byte[])

숫자 컨트롤 코드를 사용하여 Socket의 하위 수준 운영 모드를 설정합니다.

public:
 int IOControl(int ioControlCode, cli::array <System::Byte> ^ optionInValue, cli::array <System::Byte> ^ optionOutValue);
public int IOControl (int ioControlCode, byte[]? optionInValue, byte[]? optionOutValue);
public int IOControl (int ioControlCode, byte[] optionInValue, byte[] optionOutValue);
member this.IOControl : int * byte[] * byte[] -> int
Public Function IOControl (ioControlCode As Integer, optionInValue As Byte(), optionOutValue As Byte()) As Integer

매개 변수

ioControlCode
Int32

수행할 작업의 컨트롤 코드를 지정하는 Int32 값입니다.

optionInValue
Byte[]

작업에 필요한 입력 데이터가 들어 있는 Byte 배열입니다.

optionOutValue
Byte[]

작업에서 반환된 출력 데이터가 들어 있는 Byte 배열입니다.

반환

Int32

optionOutValue 매개 변수의 바이트 수입니다.

예외

소켓에 액세스하는 동안 오류가 발생했습니다.

Socket이 닫혔습니다.

Blocking 속성을 사용하지 않고 블로킹 모드를 변경하려고 한 경우

호출 스택에 있는 호출자에게 필요한 권한이 없는 경우

예제

다음 코드 예제에서는 FIONREAD의 결과와 Available 속성을 비교합니다.

// 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 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;
 }

설명

이 메서드는 IOControl 클래스의 현재 인스턴스 Socket 를 기본으로 하는 Socket 운영 체제에 대한 낮은 수준의 액세스를 제공합니다. 자세한 내용은 WSAIoctl 설명서를 참조하세요.

참고

받는 SocketException경우 속성을 사용하여 SocketException.ErrorCode 특정 오류 코드를 가져옵니다. 이 코드를 가져온 후 오류에 대한 자세한 설명은 Windows Sockets 버전 2 API 오류 코드 설명서를 참조하세요.

참고

애플리케이션에 네트워크 추적을 사용하도록 설정하면 이 멤버에서 추적 정보를 출력합니다. 자세한 내용은 .NET Framework 네트워크 추적을 참조하세요.

적용 대상

IOControl(IOControlCode, Byte[], Byte[])

Socket 열거형으로 컨트롤 코드를 지정하여 IOControlCode의 하위 수준 운영 모드를 설정합니다.

public:
 int IOControl(System::Net::Sockets::IOControlCode ioControlCode, cli::array <System::Byte> ^ optionInValue, cli::array <System::Byte> ^ optionOutValue);
public int IOControl (System.Net.Sockets.IOControlCode ioControlCode, byte[]? optionInValue, byte[]? optionOutValue);
public int IOControl (System.Net.Sockets.IOControlCode ioControlCode, byte[] optionInValue, byte[] optionOutValue);
member this.IOControl : System.Net.Sockets.IOControlCode * byte[] * byte[] -> int
Public Function IOControl (ioControlCode As IOControlCode, optionInValue As Byte(), optionOutValue As Byte()) As Integer

매개 변수

ioControlCode
IOControlCode

수행할 작업의 컨트롤 코드를 지정하는 IOControlCode 값입니다.

optionInValue
Byte[]

해당 작업에 필요한 입력 데이터를 포함하는 Byte 형식의 배열입니다.

optionOutValue
Byte[]

해당 작업에서 반환된 출력 데이터를 포함하는 Byte 형식의 배열입니다.

반환

Int32

optionOutValue 매개 변수의 바이트 수입니다.

예외

소켓에 액세스하는 동안 오류가 발생했습니다.

Socket이 닫혔습니다.

Blocking 속성을 사용하지 않고 블로킹 모드를 변경하려고 한 경우

예제

다음 코드 예제에서는 호출 IOControl 결과와 DataToRead 속성을 비교합니다 Available .

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)
{
    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;
}

설명

이 메서드는 클래스의 현재 인스턴스 Socket 를 기본으로 하는 Socket 운영 체제에 대한 낮은 수준의 액세스를 제공합니다. 자세한 내용은 WSAIoctl 설명서를 참조하세요.

참고

받는 SocketException경우 속성을 사용하여 SocketException.ErrorCode 특정 오류 코드를 가져옵니다. 이 코드를 가져온 후 오류에 대한 자세한 설명은 Windows Sockets 버전 2 API 오류 코드 설명서를 참조하세요.

참고

애플리케이션에 네트워크 추적을 사용하도록 설정하면 이 멤버에서 추적 정보를 출력합니다. 자세한 내용은 .NET Framework 네트워크 추적을 참조하세요.

적용 대상