KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm communicating between two processes on different machines via a pipe, using IO completion routines. Occasionally, when the completion routine for WriteFileEx gets called, the completion routine parameter dwErrorCode is 0 (i.e. no error), GetOverlappedResult returns true (i.e. no error), but dwNumberOfBytesTransfered does not match nNumberOfBytesToWrite in the call to WriteFileEx. I only see this on the client end of the pipe however. If the number of bytes transferred does not match the number of bytes that was requested to transfer, how can this be deemed a success? This is how the client's handle to the pipe is created: mHPipe = CreateFile(pipeName, // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe FILE_FLAG_OVERLAPPED | // overlapped FILE_FLAG_WRITE_THROUGH, // write through mode NULL); // no template file // do some checking... // The pipe connected; change to message-read mode. DWORD dwMode = PIPE_READMODE_MESSAGE; BOOL fSuccess = SetNamedPipeHandleState(mHPipe, // pipe handle &dwMode, // new pipe mode NULL, // don't set maximum bytes NULL); // don't set maximum time Can anyone see why this would happen? Thanks EDIT: The relevant WriteFileEx code is as follows: void WINAPI CompletedWriteRoutine(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverLap) { BOOL fWrite = FALSE; LPPIPEINST lpPipeInst = (LPPIPEINS
Tags (comma-separated)
Save Edits
Cancel