Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/1402#discussion_r147185326 --- Diff: lib/csharp/src/Transport/TNamedPipeClientTransport.cs --- @@ -88,7 +89,18 @@ public override void Write(byte[] buf, int off, int len) throw new TTransportException(TTransportException.ExceptionType.NotOpen); } - client.Write(buf, off, len); + // if necessary, send the data in chunks + // there's a system limit around 0x10000 bytes that we hit otherwise + // MSDN: "Pipe write operations across a network are limited to 65,535 bytes per write. For more information regarding pipes, see the Remarks section." + var nBytes = Math.Min(len, 15 * 4096); // 16 would exceed the limit + while (nBytes > 0) + { + client.Write(buf, off, nBytes); + + off += nBytes; + len -= nBytes; + nBytes = Math.Min(len, nBytes); --- End diff -- Shouldn't this be the same calculation as the one outside the loop? Technically it doesn't have to be, however I found this confusing to read.
---