다음을 통해 공유


클라이언트 개체에서 제어 작업 수행

WSK(Winsock Kernel) 애플리케이션이 WSK 하위 시스템에 성공적으로 연결되면 첨부하는 동안 WSK 하위 시스템에 의해 반환된 클라이언트 개체( WSK_CLIENT)에서 제어 작업을 수행할 수 있습니다. 이러한 제어 작업은 특정 소켓에만 국한된 것이 아니라 보다 일반적인 scope. 클라이언트 개체에서 수행할 수 있는 각 컨트롤 작업에 대한 자세한 내용은 WSK 클라이언트 제어 작업을 참조하세요.

WSK 애플리케이션은 WskControlClient 함수를 호출하여 클라이언트 제어 작업을 수행합니다. WskControlClient 함수는 첨부하는 동안 WSK 하위 시스템에 의해 반환된 WSK_PROVIDER_DISPATCH 구조체의 WskControlClient 멤버가 가리켰습니다.

다음 코드 예제에서는 WSK 애플리케이션이 WSK_TRANSPORT_LIST_QUERY 클라이언트 제어 작업을 사용하여 새 소켓을 만들 때 지정할 수 있는 사용 가능한 네트워크 전송 목록을 검색하는 방법을 보여 줍니다.

// Function to retrieve a list of available network transports
NTSTATUS
  GetTransportList(
    PWSK_PROVIDER_NPI WskProviderNpi,
    PWSK_TRANSPORT TransportList,
    ULONG MaxTransports,
    PULONG TransportsRetrieved
    )
{
  SIZE_T BytesRetrieved;
  NTSTATUS Status;

  // Perform client control operation
  Status =
    WskProviderNpi->Dispatch->
        WskControlClient(
          WskProviderNpi->Client,
          WSK_TRANSPORT_LIST_QUERY,
          0,
          NULL,
          MaxTransports * sizeof(WSK_TRANSPORT),
          TransportList,
          &BytesRetrieved,
          NULL  // No IRP for this control operation
          );

  // Convert bytes retrieved to transports retrieved
  TransportsRetrieved = BytesRetrieved / sizeof(WSK_TRANSPORT);

  // Return status of client control operation
  return Status;
}