DNS question??
DNS question??
DNS question??
DNS question??
DNS question??
DNS question?? DNS question?? DNS question?? DNS question?? DNS question?? DNS question?? DNS question?? DNS question??
DNS question?? DNS question??
DNS question??
Go Back  Xtreme Visual Basic Talk > > > DNS question??


Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2004, 04:21 AM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,795
Question DNS question??


I've just getting started on converting my network stuff from VB6 to vb.net.

I've got a question/s.

Here is my following code it retreives my network(IP address) and My internet IP address respectively.

Code:
Dim hostName As String = System.Net.Dns.GetHostName() For a As Integer = 0 To Dns.GetHostByName(hostName).AddressList.Length - 1 TextBox1.Text += Dns.GetHostByName(hostName).AddressList(a).ToString & vbNewLine Next a

AddressList(0) = Local IP Address (Network).
AddressList(1) = Internet IP Address.

Now what i'm trying to figure out is, will this always be so.

-- Questions --

(1) If the user has no network card will the Internet IP Address be at AddressList(0) or no Local IP address has been set will the Internet IP Address again it be at AddressList(0)

(2) if you are not connected to the net the AddressList(1) for the Internet IP Address should not be there, should it not.

What I'm trying to do is always get the Local IP address and always get the internet IP address, it needs to be reliable as possible.

the pig..
Reply With Quote
  #2  
Old 11-01-2004, 03:12 PM
petbo petbo is offline
Newcomer
 
Join Date: May 2004
Posts: 20
Default

Umm... What I do is make a winsock control, and then use the properties [something like winsock.ipaddress] to find my IP address... It seems to work a treat - but perhaps this isn't how you want to do it (added overhead etc)?

Pete
Reply With Quote
  #3  
Old 11-02-2004, 01:51 AM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,795
Default

The trouble is with that is legecy code, the idea of using the Winsock control is pointless now in vb.net. and it should be banished completely.

the pig..
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DNS question??
DNS question??
DNS question?? DNS question??
DNS question??
DNS question??
DNS question?? DNS question?? DNS question?? DNS question?? DNS question?? DNS question?? DNS question??
DNS question??
DNS question??
 
DNS question??
DNS question??
 
-->