Solved

TCP/IP Addresses and Visual Basic

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 407
Excel Automation VBA 19 68
Send outlook email from VBS Script 2 28
C# LINQ ForEach() question 6 22
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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

776 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