piggybank1974
10-27-2004, 04:21 AM
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.
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..
I've got a question/s.
Here is my following code it retreives my network(IP address) and My internet IP address respectively.
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..