Using select() to handle multiple requests