1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 using System.Net; 11 12 namespace WindowsFormsApplication1 13 { 14 public partial class Form1 : Form 15 { 16 public Form1() 17 { 18 InitializeComponent(); 19 } 20 21 private void button1_Click(object sender, EventArgs e) 22 { 23 textBox2.Text = string.Empty; 24 IPAddress[] ips = Dns.GetHostAddresses(textBox1.Text); 25 foreach (IPAddress ip in ips) 26 { 27 textBox2.Text = ip.ToString(); 28 } 29 textBox3.Text = Dns.GetHostName(); 30 textBox4.Text = Dns.GetHostByName(Dns.GetHostName()).HostName; 31 } 32 } 33 }