Solved

TCP/IP Addresses and Visual Basic

Posted on 1997-06-12
1
270 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

752 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