loop for client