windows - Is there any way to detect whether client pipe's handle is closed when using NamedPipe? -


i wondering if there way detect status of client pipe's handle server side on windows platform.

even though client closed pipe(disconnected) closehandle() function, there seems no way detect server side.

using waitforsingleobject() handle object returns wait_object_0, regardless of status of client handle. so, solution detect whether client pipe's handle closed or not server side less cost?

if reading data pipe (pipe_access_inbound or pipe_access_duplex) error_broken_pipe when client closes end of pipe. if aren't ready process data pipe start reading ahead of time (using asynchronous i/o) in order detect when pipe broken.

note if there more 1 handle client end of pipe, considered closed when last handle closed. might issue, example, if client inadvertently causes subprocess inherit copy of handle.

i don't know of way detect client has closed outbound-only pipe without writing data it. best option may use pipe_access_duplex if incoming side of pipe ever used detect when pipe has been broken.

for future reference, although handle can used synchronization object, doing not recommended , far know supported use detect completion of asynchronous i/o operation no event object specified.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -