Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TCP/IP Addresses and Visual Basic

Posted on 1997-06-12
1
Medium Priority
?
281 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 400 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 about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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