refactored client_recv and serv_recv