finsh the function of replying to client