add recv_timeout() and main() in agent