NamedPipeServerStream::WaitForConnection Method ()

 

Waits for a client to connect to this NamedPipeServerStream object.

Namespace:   System.IO.Pipes
Assembly:  System.Core (in System.Core.dll)

public:
[SecurityCriticalAttribute]
void WaitForConnection()

Exception Condition
InvalidOperationException

A pipe connection has already been established.

-or-

The pipe handle has not been set.

ObjectDisposedException

The pipe is closed.

IOException

The pipe connection has been broken.

Calling this method causes the NamedPipeServerStream object to block until a client connects.

The following example demonstrates a method to send a string from a parent process to a child process using named pipes. This example creates a NamedPipeServerStream object in a parent process. This object has a PipeDirection value of Out, which then blocks until a NamedPipeClientStream object establishes a connection to the NamedPipeServerStream object. This example is part of a larger example provided for the NamedPipeServerStream and NamedPipeClientStream classes.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show: