Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Get specific IP address of PC, regardless of which adapter.
Anthony Gags
Jun 27 2017 11:10 PM
188
Reply
Hi There,
i have a program that is trying to get the IP address of any PC on our netowrk
I have been using the below semi-successfully, yet it will only work if an IP address actually exists in the first list.
string
HostName
=
Dns
.
GetHostName
();
Dns
.
GetHostEntry
(
HostName
).
AddressList
[
0
].
ToString
()
however,
the problem arises when the entry 0 does not exist, and it is actually entry 1 or 2 for that matter..
How can i go around this so that no matter which entry actually has the IP address of 192.168.XXX.XXX, it will p[ick it up and tell me the whole IP.
Thanks in advance
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
What does compiler do internally when compile C# program?
Planning to take up classes on MVC, WCF and WPF in Chennai