# Function Reference

# _NamedPipes_ConnectNamedPipe

Enables a named pipe server process to wait for a client process to connect

#include <NamedPipes.au3>
_NamedPipes_ConnectNamedPipe ( $hNamedPipe [, $tOverlapped = 0] )

## Parameters

$hNamedPipe | Handle to the server end of a named pipe instance
$tOverlapped | [optional] a $tagOVERLAPPED structure. If $hNamedPipe was opened with $PIPE_FLAG_OVERLAPPED, $pOverlapped must not be 0. If $hNamedPipe was created with $PIPE_FLAG_OVERLAPPED and $pOverlapped is not 0, the $tagOVERLAPPED structure should contain a handle to a manual reset event object. If $hNamedPipe was not opened with $PIPE_FLAG_OVERLAPPED, the function does not return until a client is connected or an error occurs. Successful synchronous operations result in the function returning a nonzero value if a client connects after the function is called.

## Return Value

Success: | True.
Failure: | False.

## Remarks

If a client connects before the function is called, the function returns zero and _WinAPI_GetLastError() will return $ERROR_PIPE_CONNECTED (defined in APIErrorsConstants.au3).
This can happen if a client connects in the interval between the call to _NamedPipes_CreateNamedPipe() and the call to _NamedPipes_ConnectNamedPipe().
In this situation, there is a good connection between client and server even though the function returns zero.

## Related

$tagOVERLAPPED, _NamedPipes_CreateNamedPipe

## See Also

Search ConnectNamedPipe in MSDN Library.