Yeah... Don't use Thread.Sleep() here. This is just guessing and makes your code unreliable.
Example: Replace your "ping -c 10 127.0.0.1" with a "ping -c 10 google.com" and it will fail. Since it takes more than 200 ms for a ping reply.
Example: Replace your "ping -c 10 127.0.0.1" with a "ping -c 10 google.com" and it will fail. Since it takes more than 200 ms for a ping reply.