[System.Net을 이용하여 알아보기]

bool networkUp
   
= System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();

 

또는

 

NetworkInterface[] networkCards
   
= System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();

 

[IP를 이용하여 알아보기]

IPEndPoint ipep =  new IPEndPoint(Ipaddress.Parse("IP TO CHECK"), YOUR_PORT_INTEGER);
Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
server
.Connect(ipep);

 

[Ping 테스트로 알아보기]

Ping netMon = new Ping();
PingResponse response = netMon.PingHost(hostname, 4);
if (response != null)
{
   
ProcessResponse(response);
}

 

+ Recent posts