해당 프로그램은 Windows 10 위에서 실행되는 C# 으로 만들어진 프로그램에서 , 외부 OS에 ping 으로 보내, network 연결을 확인하는 프로그램 입니다.
try
{
Ping ping = new Ping();
PingOptions options = new PingOptions();
options.DonFragment = true;
string data = "Hello World!";
byte[] buffer = ASCIIEncoding.ASCII.GetBytes(data);
int timeout = 120;
PingReply reply = ping.Send(IPAddress.Parse("111.111.111.111"), timeout, buffer, options);
if (reply.Status == IPStatus.Success)
{
//Online
}
else
{
//Offline
}
}
catch
{
}
finally
{
}
'other_program_languages > c#' 카테고리의 다른 글
c# sftp 사용 ubuntu 로 file 전송 (0) | 2022.11.24 |
---|---|
c# telnet client program (0) | 2022.11.24 |
C# ssh client program (0) | 2022.11.24 |