2.1.4.1.1 CallNamedPipe


Description

Connects to a message-type pipe (and waits if an instance of the pipe is not available), writes to and reads from the pipe, and then closes the pipe.

Syntax

BOOL CallNamedPipe( LPCTSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut )

Parameters

lpNamedPipeName
[input] The pipe name.
lpInBuffer
[input] The data to be written to the pipe.
nInBufferSize
[input] The size of the write buffer, in bytes.
lpOutBuffer
[output] A pointer to the buffer that receives the data read from the pipe.
nOutBufferSize
[input] The size of the read buffer, in bytes.
lpBytesRead
[output] A pointer to a variable that receives the number of bytes read from the pipe.
nTimeOut
[input] The number of milliseconds to wait for the named pipe to be available. In addition to numeric values, the following special values can be specified.

Return

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Examples

Remark

Calling CallNamedPipe is equivalent to calling the CreateFile (or WaitNamedPipe, if CreateFile cannot open the pipe immediately), TransactNamedPipe, and CloseHandle functions. CreateFile is called with an access flag of GENERIC_READ | GENERIC_WRITE, and an inherit handle flag of FALSE.

CallNamedPipe fails if the pipe is a byte-type pipe.


See Also

CreateNamedPipe,WaitNamedPipe

Header to Include

origin.h

Reference