TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Finding The Ip Address Of You Computer On C#
Vijayaragavan S
Aug 27
2016
Code
1.3
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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#