I/O multiplexing using select: