implemented sending requests using select