in reply to Managing multiple bi-directional pipes
Also, if you are into trying threading, see Simple threaded chat server