How to read the exact bytes sent?

Hi,
I have faced with similar problem a few days ago, and solve my problem with adding s.CloseWrite() call to notify reader side to read all. Hope can solve your issue too.