Share via


IOCTL_SERVICE_CONNECTION (Compact 2013)

3/26/2014

This I/O control message provides a pointer to the accepted Windows socket. When an incoming network connection arrives to a service's listen port, Servicesd.exe will call the accept (Windows Sockets) function on the connection, and then call into the service with this I/O control and the input parameter as the accepted socket. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,          // handle to the device
    DWORD dwIoControlCode,   // use IOCTL_SERVICE_CONNECTION
    LPVOID lpInBuffer,       // pointer to input buffer
    DWORD nInBufferSize,     // input buffer size
    LPVOID lpOutBuffer,      // pointer to output buffer
    DWORD nOutBufferSize,    // output buffer size
    LPDWORD lpBytesReturned, // number of bytes returned
    OVERLAPPED lpOverlapped  // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device.
  • dwIoControlCode
    [in] The control code for the operation. Use IOCTL_SERVICE_CONNECTION for this operation.
  • lpInBuffer
    [in] Pointer to the accepted Windows socket.

Return Values

Returns TRUE if successful; otherwise, returns FALSE. To obtain extended error information, call the SetLastError function.

Remarks

The service is always responsible for calling the closesocket function on this socket, even if an internal error, such as running out of memory, occurs in the xxx_IOControl (Servicesd.exe) function. Services should not process the request on this thread, as they will be blocking the accept thread for the super service thread. Servers should instead spin threads to process requests.

Requirements

Header

service.h

See Also

Reference

Servicesd.exe IOCTLS
xxx_IOControl (Servicesd.exe)

Other Resources

accept (Windows Sockets)
closesocket