 |
|
|
|
 |
|
Inter-Process Communication in .NET Using Named Pipes, Part 1
6. Other Named Pipes Operations
Some other operations, part of the IPC, include disconnecting, flushing and closing Named Pipes.
DisconnectNamedPipe disconnects one end of the pipe from the other. Disconnecting a server pipe allows the latter to be reused by releasing it from the client pipe. This technique is shown in Part 2 of the article where we build a multithreaded Named Pipes server.
FlushFileBuffers writes to the pipe any buffered data. It is often used in conjunction with writing operations before closing a Named Pipe.
CloseHandle is used to close a Named Pipe and release its native handle. It is important to always close a pipe after finishing working with it in order to release any related resources, therefore any Named Pipes operations should be wrapped in a try-catch-finally block and the CloseHandle method should be placed in the finally part.
.NET Named Pipes Discussion
|
|
 |