use select() and split server code