110,534
社区成员
发帖
与我相关
我的任务
分享
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;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IPHostEntry host = Dns.Resolve(txtUrl.Text);
foreach (IPAddress add in host.AddressList)
{
long ip = add.Address;
listBox1.Items.Add(add.ToString());
listBox1.Items.Add(ip.ToString());
}
txtName.Text = host.HostName;
txtBroad.Text = IPAddress.Broadcast.ToString();
}
}
}