Pastikan preference di tambahkan System.Net
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.NetworkInformation;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void cmdprosses_Click(object sender, EventArgs e)
{
Ping data = new Ping();
PingReply sendping = data.Send(txtip.Text, 200);
if (sendping.Status==IPStatus.Success)
{
lblstts.Text="server is online";
}
else
{
lblstts.Text="server is offline";
}
}
}
}
Hasil Jadinya
Tidak ada komentar:
Posting Komentar