Hi, I got problem with Interprocess communication in MFC
I am using vs2003
I have got project using named pipes. It seems to be perfect, However, When client want to create the file it always fails
the pseudo code
Server
- Create Named Pipe
- Read File
Client
- Create File
- Write File
the code it self in client side
m_hPipe = CreateFile(ISOCOMSPIPE,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(m_hPipe == INVALID_HANDLE_VALUE)
{
int iRet = GetLastError();
if(iRet == ERROR_PIPE_BUSY)
{
if(!WaitNamedPipe(ISOCOMSPIPE,1000))
{
m_hPipe = CreateFile (ISOCOMSPIPE,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
//CHECK ERROR MESSAGE AGAIN
if(m_hPipe == INVALID_HANDLE_VALUE)
{
int iRet = GetLastError();
printf("%s \n",iRet);
return iRet;
}
}
I still got error message 231 which all pipe instances are busy
Any idea how to solve this one. Thanks