Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Finding The Ip Address Of You Computer On C#
WhatsApp
Vijayaragavan S
Aug 27
2016
1.3
k
0
2
using
System;
using
System.Net;
//Network Name space
class
FindanIP {
static
void
Main() {
String HostName =
string
.Empty;
//Read the Host Name.
HostName = Dns.GetHostName();
Console.WriteLine(
"Local Machine Name: "
+ HostName);
IPHostEntry ipEntry = Dns.GetHostEntry(HostName);
// Using this method we can get Host Name,IP address is obtained.
IPAddress[] addr = ipEntry.AddressList;
for
(
int
i = 0; i < addr.Length; i++) {
Console.WriteLine(
"IP Address is : "
+ addr[i].ToString());
}
Console.ReadKey();
}
}
IP address
C#
Up Next
Finding The Ip Address Of You Computer On C#