added support for multiple clients using select()