-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.cs
More file actions
33 lines (31 loc) · 1009 Bytes
/
Form1.cs
File metadata and controls
33 lines (31 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Net; // 다양한 네트워크 프로토콜에 대한 간단한 프록래밍 인터페이스 제공
namespace ip_viewer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnOk_Click(object sender, EventArgs e)
{
try
{
string hostname = null;
IPAddress[] ips;
hostname = Dns.GetHostName();
ips = Dns.GetHostAddresses(hostname);
foreach(IPAddress ip in ips)
{
this.lbIp.Items.Add("Hostname : " + hostname);
this.lbIp.Items.Add("Ip address : "+ ip.ToString());
}
}
catch
{
MessageBox.Show("정보를 나타내는데 오류가 있습니다", "오류 메시지"
,MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}