Named Pipe
1.
The type modes must be the same for all instances of a pipe.
2.
3. FILE_FLAG_WRITE_THROUGH affects only write operations to byte-type pipes between pipe clients and pipe servers on different computers.
The write-through mode of a pipe handle cannot be changed after the pipe handle has been created.
The write-through mode can be different for server and client handles to the same pipe instance.
4. For a message-type pipe, the read mode can be different for server and client handles to the same pipe instance.
6. For a pipe client, a pipe handle returned by CreateFile is always in byte-read mode initially.
7. The nonblocking-wait mode is supported for compatibility with Microsoft® LAN Manager version 2.0. This mode should not be used to achieve overlapped input and output (I/O) with named pipes.
8. A client that is forced off a pipe by DisconnectNamedPipe must still use theCloseHandle function to close its end of the pipe. This is because the pipe exists as long as a server or client process has an open handle to the pipe.
9. ConnectNamedPipe can be used to connect to a newly created pipe instance or an instance that was previously connected to another client process.(The hPipe that is disconnected but not closed by CloseHandle)
10. ConnectNamedPipe will return
@ERROR_NO_DATA --server did not call DisconnectNamedPipe and the client has closed its handle.
@ERROR_PIPE_CONNECTED--if a client connects in the interval between the call to CreateNamedPipe and the call to ConnectNamedPipe. Or server did not call DisconnectNamedPipe and the client has not closed its handle.
@ERROR_PIPE_LISTENING--no client is connected while server in nonblocking mode.
11. server's ReadFile will return ERROR_BROKEN_PIPE if the client uses CloseHandle to close the pipe, which be used to notify the server the connection can over now.
CreateNamedPipe | CreateFile |
Access/Open Mode--The open handle's read/write permission to pipe | GENERIC_WRITE|GENERIC_READ |
Type Mode--controls WriteFile uses Byte or Message type | N/A |
Read Mode--controls ReadFile uses Byte or Message type | N/A |
The type modes must be the same for all instances of a pipe.
2.
Server | Client |
CreateNamedPipe | CreateFile |
ConnectNamedPipe | WaitNamedPipe |
ReadFile/WriteFile | ReadFile/WriteFile |
DisconnectNamedPipe | CloseHandle |
3. FILE_FLAG_WRITE_THROUGH affects only write operations to byte-type pipes between pipe clients and pipe servers on different computers.
The write-through mode of a pipe handle cannot be changed after the pipe handle has been created.
The write-through mode can be different for server and client handles to the same pipe instance.
4. For a message-type pipe, the read mode can be different for server and client handles to the same pipe instance.
6. For a pipe client, a pipe handle returned by CreateFile is always in byte-read mode initially.
7. The nonblocking-wait mode is supported for compatibility with Microsoft® LAN Manager version 2.0. This mode should not be used to achieve overlapped input and output (I/O) with named pipes.
8. A client that is forced off a pipe by DisconnectNamedPipe must still use the
9. ConnectNamedPipe can be used to connect to a newly created pipe instance or an instance that was previously connected to another client process.(The hPipe that is disconnected but not closed by CloseHandle)
10. ConnectNamedPipe will return
@ERROR_NO_DATA --server did not call DisconnectNamedPipe and the client has closed its handle.
@ERROR_PIPE_CONNECTED--if a client connects in the interval between the call to CreateNamedPipe and the call to ConnectNamedPipe. Or server did not call DisconnectNamedPipe and the client has not closed its handle.
@ERROR_PIPE_LISTENING--no client is connected while server in nonblocking mode.
11. server's ReadFile will return ERROR_BROKEN_PIPE if the client uses CloseHandle to close the pipe, which be used to notify the server the connection can over now.