473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Local ACTIVE IP address - a foolproof method?

I ma using VB.net 2003. I thought this would be easy to do and apologise for
asking again - I have been trying. I would like to obtain the ACTIVE local
IP address - i.e. the one connected to the network and active. I have tried
the code below, and have iterated through a number of possible adaptors to
poulate a listbox. This is not ideal, but I could live with it. NOTE - all
of the machines I will be running it on will have a permanent broadband
connection (if that makes life any easier). The problem is that it does not
always seem to work on all PCs I have tried it with. The code I have used is
as follows:-
Dim i As Integer
Dim h As System.Net.IPHostEntry =
System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tName)
Try : sIpAddr0 = (CType(h.AddressList.GetValue(0), IPAddress).ToString) :
Catch : End Try
Try : sIpAddr1 = (CType(h.AddressList.GetValue(1), IPAddress).ToString) :
Catch : End Try
Try : sIpAddr2 = (CType(h.AddressList.GetValue(2), IPAddress).ToString) :
Catch : End Try

Many thanks in anticipation,

Paul Bromley
Dec 8 '06 #1
0 786

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but...
10
by: huzz | last post by:
I have web application that quaries the Active Directory to get user details.. everything works fine but someday I'll get System.Runtime.InteropServices.COMExection and if I restart the client...
3
by: Frank Jiao | last post by:
I can get my local IPv6 address in Win2003 use the source code as below: string localName = Dns.GetHostName(); string address = ""; string scopeId = ""; IPHostEntry hostEntry = Dns.Resolve(...
2
by: Joseph | last post by:
Has anyone had any experience gathering the local computername through a web application with no client side program. I've been researching different avenues and have been coming up blank so far. ...
3
by: jimmyfishbean | last post by:
Hi, My client has the following network structure: 2 Windows 2003 servers : Server 1 - Web server running IIS, ftp import and export folder, ASP.NET SOAP web service and asp code on here....
0
by: Michael Höhne | last post by:
Hi, we're developing some web services and use the local development server of Visual Studio 2005 to create, run and debug the project. The web service methods connect to a database hosted on a...
4
by: SJ | last post by:
How can I find the local Machine's MAC address using asp.net? Thanks, -SJ
18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
6
by: =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= | last post by:
Hi, Is there a way to validate an email address and to check whether it is sendable? Function EmailTo(ToEmail, FromEmail, strSubject, strBody) Set objMessage = CreateObject("CDO.Message")...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.