Re: A question about Named Pipe?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 20 Oct 2005 22:52:04 -0400
I have a memory that it will come out of its ReadFile with (or for async, the notification
will contain) an error indication, and the error code (e.g., via GetLastError or other
means) will be ERROR_BROKEN_PIPE. If the server disconnects the pipe, that is the end of
the session and it would make no sense to send additional information to the server via
that pipe. I'd always used an explicit end-of-data notification which one side would send
the other to indicate termination, so I never worried too much about the closure issue,
except to record errors.
joe
On Thu, 20 Oct 2005 15:52:02 -0700, "Nicky" <Nicky@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>hi,all
>I have a question about named pipe.
>How does the pipe server know the client closed the connection?
>We can refer the example for CreateNamedPipe() function in MSDN.
>In block mode, once ConnectNamedPipe() returns, it means the client called
>CreateFile(),
>and after finish reading and writing, client call CloseHandle(), at this
>point, how does the pipe server know the pipe has been closed? And if client
>did not call CloseHandle(), but not write anything to the pipe, what will be
>returned in the server side ReadFile()?
>Becuase in mostly examples, the server pipe will ReadFile(), and then
>WriteFile() back and then DisconnectNamedPipe(), what if the client needs to
>sleep 10 minutes and then send some text to server?
>Thanks.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: About class CRectTracker question.
- Next by Date: Re: insert dialog
- Previous by thread: Re: insert dialog
- Next by thread: About UDF(universal Disc Format)
- Index(es):
Relevant Pages
|