Pro EP 9: How to Ping a Host in C#

Muhammad Waseem
Become .NET Pro !
1 min readFeb 24, 2023

In C#, the Ping class can be used to check the availability of a remote host by sending a ping request to the host and waiting for a response.

When you are facing issue at some environment you might have heard you team lead saying that ping at environment (production, stage , dev etc.) and check is it working or not then you might have used 𝚙𝚒𝚗𝚐 𝚑𝚘𝚜𝚝𝚗𝚊𝚖𝚎 at command prompt to verify it. Let’s see how can we achieve this via C# Code.

If you want to help the author in growing

  1. Subscribe my Weekly .NET Newsletter of C#/.NET
  2. Follow me on LinkedIn/Twitter OR Clap at least 50 times.
  3. Get exclusive .NET Questions & Answers by becoming a Patron , I add almost 25+ new questions with explanation per month.
  4. Download my eBook at Gum road that contains 30 .NET Tips.

--

--