implemented ping-pong protocol