changed the while condition in the server and added a random time to wait before sending messages in the mobile