title: Overlapped message named pipe, ERROR_MORE_DATA and CancelIoEx
body: <p>I am using $SUB for the first time and have come across this problem. Both, client and server use overlapped operations and here is the specific situation I have a problem with.</p>
  
  <p>Client</p>
  
  <p>C1. Connects to the server.<br>
  C2. Sends the message bigger than a pipe buffer and buffer passed to overlapped read operation in the server.<br>
  C3. Successfully cancels the send operation.<br></p>
  
  <p>Server</p>
  
  <p>S1. Creates and waits for the client.<br>
  S2. When the client is connected, it reads the message.<br>
  S21. Because message doesn't fit into the buffer(ERROR_MORE_DATA), it is read part by part.<br></p>
  
  <p>It seems to me that there is no way to tell when is the whole message, as an isolated unit, canceled. In particular, if client cancels the send operation, server does not receive the whole message, just a part of it, and consequent read operation returns with ERROR_IO_PENDING (in my case), which means there is no data to be read and read operation has been queued. I would expect to have some kind of means telling the reader that the message has been canceled, so that reader can act upon it.</p>
  
  <p>However, relevant documentation is scatter over MSDN, so I may as well be missing something. I would really appreciate if anyone can shed some light on it. Thanks.</p>