BTW the remaining buffer will automatically increase if 开发者_Python百科the other side reads data out of it,right?
How about PeekNamedPipe
? It would seem that the following will return the total number of bytes remaining to be read from the pipe.
DWORD totalBytesAvailable;
BOOL WINAPI PeekNamedPipe(
handle, // __in HANDLE hNamedPipe,
NULL, // __out_opt LPVOID lpBuffer,
0, // __in DWORD nBufferSize,
NULL, // __out_opt LPDWORD lpBytesRead,
&totalBytesAvailable, // __out_opt LPDWORD lpTotalBytesAvail,
NULL // __out_opt LPDWORD lpBytesLeftThisMessage
);
精彩评论