With Windows named pipes, what is the proper way to use the CreateNamedPipe
, ConnectNamedPipe
, DisconnectNamedPipe
, and CloseHandle
calls?
I am making a server app which is connecting to a client app which connects and disconnects to the pipe multiple times across a session.
When my writes fail because the client disconnected, should I call DisconnectNamedPipe
, CloseHandle
, or nothing on my handle.
Then, to accept a new connection, should I call CreateNamedPipe
and then ConnectNamedPipe
, or just ConnectNamedPipe
?
I would very much like an explanation of the different states my pipe can be in as a result of these calls, because I have not found this elsewhere.
Additional info:
Language: Python using the win32pipe
,win32file
and win32api
libraries.
Pipe settings: WAIT, no overlap, bytestream.