Solved

TCP/IP Addresses and Visual Basic

Posted on 1997-06-12
1
246 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
1 Comment
 
LVL 5

Accepted Solution

by:
y96andha earned 200 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now