"c# check remote computer is online" Code Answer's
You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "c# check remote computer is online" answered properly. Developers are finding an appropriate answer about c# check remote computer is online related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like c# check remote computer is online. Enter your desired code related query in the search bar and get every piece of information about C# code related question on c# check remote computer is online.
c# check remote computer is online
// using System.Management;
private static bool IsMachineOnline(string hostName)
{
bool retVal = false;
ManagementScope scope = new ManagementScope(string.Format(@"{0}rootcimv2", hostName));
ManagementClass os = new ManagementClass(scope, new ManagementPath("Win32_OperatingSystem"), null);
try
{
ManagementObjectCollection instances = os.GetInstances();
retVal = true;
}
catch (Exception ex)
{
retVal = false;
Console.WriteLine(ex.Message);
}
return retVal;
}
Source: morgantechspace.com
c# check remote computer is online
// using System.Net.NetworkInformation;
private static bool IsMachineUp(string hostName)
{
bool retVal = false;
try
{
Ping pingSender = new Ping();
PingOptions options = new PingOptions();
// Use the default Ttl value which is 128,
// but change the fragmentation behavior.
options.DontFragment = true;
// Create a buffer of 32 bytes of data to be transmitted.
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
byte[] buffer = Encoding.ASCII.GetBytes(data);
int timeout = 120;
PingReply reply = pingSender.Send(hostName, timeout, buffer, options);
if (reply.Status == IPStatus.Success)
{
retVal = true;
}
}
catch (Exception ex)
{
retVal = false;
Console.WriteLine(ex.Message);
}
return retVal;
}
Source: morgantechspace.com
All those coders who are working on the C# based application and are stuck on c# check remote computer is online can get a collection of related answers to their query. Programmers need to enter their query on c# check remote computer is online related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about c# check remote computer is online for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of c# check remote computer is online while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "c# check remote computer is online". Visit this developer's friendly online web community, CodeProZone, and get your queries like c# check remote computer is online resolved professionally and stay updated to the latest C# updates.