?
Solved

How can I get a list of ip addresses on my local pc?

Posted on 2002-04-19
8
Medium Priority
?
201 Views
Last Modified: 2013-11-13
I want to be able to get a list of the ip addresses for ll of the NICs in my pc. Currently I have 2 NICs in my pc. The ip address for 1 is fixed, 192.168.128.xxx, the other ip address is set by dhcp and not stable.
I know I could shell out to IPCONFIG and redirect the output to a file and parse it out to get the ip addresses. But this doesn't seem like a good solution to me.
Any ideas?
0
Comment
Question by:chaos_59
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:RichW
ID: 6954919
Why not use a Winsock control, set the port on it and do something like:
Text1.Text = Winsock1.LocalIP
Text2.Text = Winsock1.LocalHostName
RichW
0
 
LVL 4

Expert Comment

by:RichW
ID: 6954929
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 800 total points
ID: 6954962
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:chaos_59
ID: 6955199
Rich, I am using a winsock control. But I am using 2 network cards (NICs). The winsock control returns the ip address of only one of the network cards. I tried setting one of the winsock controls to the ip address of one of the cards, hoping that the other winsock control would default to the 2nd network card. But they both returned the same ip address.
0
 
LVL 2

Expert Comment

by:Ber
ID: 6956836
Why don't you just set the IPs in the winsock control once you have determined the IPs using the sample given by Richie...???

Cheers...
Ber...
0
 
LVL 1

Author Comment

by:chaos_59
ID: 6958649
Ber,
I want to be able to get a list of IP addresses. I know what MY ip addresses are now, one is fixec, but the other could change within the week. I don't want to have to change the application every time my ip address changes. Also, if I move this application to another pc I don't want to have to reconfigure it. It's just a lot cleaner if the application can find the correct ip address without having any user intervention.
0
 
LVL 1

Author Comment

by:chaos_59
ID: 6958651
Thanks Richie,
I would have preferred a simpler solution to this. I don't really like api programming, but I'll take what I can get.
Thanks.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6958755
Sometimes, there is no other way that API's way (thanks to God that they exist ;). Unfortunately, some goals are impossible with vb "standard" code.
Thanks for "A" grade!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question