The TransactNamedPipe function combines into a single network operation the functions that write a message to and read a message from the specified named pipe.
BOOL TransactNamedPipe(
HANDLE hNamedPipe, |
// handle of named pipe |
LPVOID lpInBuffer, |
// address of write buffer |
DWORD nInBufferSize, |
// size of the write buffer, in bytes |
LPVOID lpOutBuffer, |
// address of read buffer |
DWORD nOutBufferSize, |
// size of read buffer, in bytes |
LPDWORD lpBytesRead, |
// address of variable for bytes actually read |
LPOVERLAPPED lpOverlapped |
// address of overlapped structure |
); |
If lpOverlapped is NULL, lpBytesRead cannot be NULL.
If lpOverlapped is not NULL, lpBytesRead can be NULL. If this is
an overlapped read operation, you can get the number of bytes read by calling GetOverlappedResult.
If hNamedPipe is associated with an I/O completion port, you can get
the number of bytes read by calling GetQueuedCompletionStatus.
If hNamedPipe was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hNamedPipe was created with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the opeation is complete.
If hNamePipe was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, TransactNamedPipe is executed as an overlapped operation. The OVERLAPPED structure should contain a manual-reset event object (which can be created by using the CreateEvent function). If the operation cannot be completed immediately, TransactNamedPipe returns FALSE and GetLastError returns ERROR_IO_PENDING. In this situation, the event object is set to the nonsignaled state before TransactNamedPipe returns, and it is set to the signaled state when the transaction has finished. For more information about overlapped operations, see Pipes.
If hNamedPipe was not opened with FILE_FLAG_OVERLAPPED, TransactNamedPipe does not return until the operation is complete.
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.
TransactNamedPipe fails if the server did not create the pipe as a message-type pipe or if the pipe handle is not in message-read mode. For example, if a client is running on the same machine as the server and uses the \\.\pipe\pipename format to open the pipe, the pipe is opened in byte mode by the named pipe file system (NPFS). If the client uses the form \\server\pipe\pipename, the redirector opens the pipe in message mode. A byte mode pipe handle can be changed to message-read mode with the SetNamedPipeHandleState function.
The function cannot be completed successfully until data is written into the buffer specified by the lpOutBuffer parameter. The lpOverlapped parameter is available to enable the calling thread to perform other tasks while the operation is executing in the background.
If the message to be read is longer than the buffer specified by the nOutBufferSize parameter, TransactNamedPipe returns FALSE and the GetLastError function returns ERROR_MORE_DATA. The remainder of the message can be read by a subsequent call to ReadFile, ReadFileEx, or PeekNamedPipe.
CreateEvent, CreateFile, CreateNamedPipe, GetOverlappedResult, GetQueuedCompletionStatus, PeekNamedPipe, ReadFile, ReadFileEx, SetNamedPipeHandleState, OVERLAPPED
See:
file: /Techref/os/win/api/win32/func/src/f88_16.htm, 7KB, , updated: 2001/6/26 09:35, local time: 2024/11/29 22:32,
18.118.227.199:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/os/win/api/win32/func/src/f88_16.htm"> TransactNamedPipe</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.