NamedPipeClientStream::NumberOfServerInstances Property
Gets the number of server instances that share the same pipe name.
Assembly: System.Core (in System.Core.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException | The pipe handle has not been set. -or- The current NamedPipeClientStream object has not yet connected to a NamedPipeServerStream object. |
| IOException | The pipe is broken or an I/O error occurred. |
| ObjectDisposedException | The underlying pipe handle is closed. |
This property returns the number of server instances for the NamedPipeServerStream object that the current NamedPipeClientStream object has a handle to or is connected to. If the current NamedPipeClientStream object has not yet connected to a named pipe server, or if the current pipe handle has not yet been set, this property throws an InvalidOperationException.
The following example demonstrates a method to send a string from a parent process to a child process using named pipes. In this example, a NamedPipeClientStream object is created in a child process, which then connects to a pipe on the local computer. The server example can be seen in the NamedPipeServerStream class. This example is part of a larger example provided for the NamedPipeServerStream and NamedPipeClientStream classes.
Available since 3.5