Search code examples
c++windowsnamed-pipes

How to know when there are maximum number of named pipe client's connections to service?


Following this sample, I can set nMaxInstances.
How can I know when the number of named pipe client's connections to exceed the maximum allowed (both service and client)?


Solution

  • When you've reached the maximum number of concurrent instances, creating the excess instance will fail.

    Microsoft haven't bothered to document their error codes for CreateNamedPipe(), so it is impossible to be more specific.

    EDIT @eryksun has kindly provided the information that the error is ERROR_PIPE_BUSY. This is stated clearly in my OS/2 manual from 1989, but it seems to have got lost in the NT project.