spmlingam's answer does address your problem. When B is about to write, use select to check if there's anything to read. If there's is, read until there isn't. Then proceed to write.
sathiya.sw's shutdown solution sounds more promising, though.
In reply to Re^3: socket read buffer full
by ikegami
in thread socket read buffer full
by targetsmart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |