Created ping code so the latency can be measured