Solved

TCP/IP Addresses and Visual Basic

Posted on 1997-06-12
1
276 Views
Last Modified: 2013-11-25
Does anyone know how to obtain the default IP address being used by a workstation (without using an OCX). I've been using the Win 32 GetHostByName function, but this only returns the first bound IP address on the workstation regardless if it is being used or not. If someone has a network card installed and is has dial up networking, I need to know which one is currently in use (assumption is that both of them will not be used at the same time).

Any help would be appreciated.

Thanks,
Dave Schwietz
www.selectinc.com
0
Comment
Question by:schwietz
[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
1 Comment
 
LVL 5

Accepted Solution

by:
y96andha earned 200 total points
ID: 1427159
The normal way to get the IP address being used is to create a socket without an IP address assigned to it, then open a connection to wherever you want to reach, and then check what address has been assigned to the socket.

If a workstation has more than one IP address, you can never say that a certain IP address is not in use, you can only say that it wouldn't be used to reach a certain target. The most default IP address must be the one which is on the same subnet as the default gateway, because if you haven't defined any special routing rules, most packets will go that way.

However, when workstations are connected to an Intranet via network adapters, and Internet via modem, there can at the same time be sessions to an Intranet WWW server using the LAN adapters IP address and sessions to external Internet servers using a single program such as Internet Explorer. Which IP address is the one in use then?


0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses
Course of the Month6 days, 21 hours left to enroll

623 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