ERROR_PIPE_BUSY - All pipe instances are busy
When I call CreateFile() second time I am getting error massege 231
[ERROR_PIPE_BUSY - All pipe instances are busy]
I am sending message from service application to client application.
Named pipe is create in service application and client application is
receving data from service application.
Service Application Functions
bool InitServer()
{
....
m_hServer = ::CreateNamedPipe(m_strPipeName,
PIPE_ACCESS_OUTBOUND,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
sizeof maxSize,
sizeof maxSize,
NMPWAIT_USE_DEFAULT_WAIT,
&sa);
....
....
}
Client Application
bool InitClient()
{
DWORD dwError = 0;
while (true)
{
m_hClient = ::CreateFile( m_strPipeName,
GENERIC_READ,
0,
0,
OPEN_EXISTING,
0,
0);
if (m_hClient != INVALID_HANDLE_VALUE)
{
break;
}
if (GetLastError() != ERROR_PIPE_BUSY)
{
return false;
}
if (!WaitNamedPipe(m_strPipeName, 10000))
{
return false;
}
}
return true;
}
Above client code working when I am connecting first time.
After restart client application I am getting above mentioned error.
WaitNamedPipe - this gives [Error Number - 121 The semaphore timeout
period has expired]
I close the handle properly when client disconnect.
any clue to solve this?
-Manoj