I am suggesting to replace TerminateThread(handle, how) calls in doexec() with WaitForSingleObject(handle, INFINITE), or, maybe, give a small timeout instead of INFINITE. This will allow pipe-to-socket thread functions to finish correctly and deliver data to client (otherwise it is lost).
I did it using #define TerminateThread(h, f) WaitForSingleObject(h, INFINITE) just before switch(i) and then #undef-ing it after last break.
I am suggesting to replace TerminateThread(handle, how) calls in doexec() with WaitForSingleObject(handle, INFINITE), or, maybe, give a small timeout instead of INFINITE. This will allow pipe-to-socket thread functions to finish correctly and deliver data to client (otherwise it is lost). I did it using #define TerminateThread(h, f) WaitForSingleObject(h, INFINITE) just before switch(i) and then #undef-ing it after last break.