0

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

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jangid
0

Restart your server application and try to connect again

Edited by Nick Evan: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.