Here is a tool I call IPLookup I wrote in .NET (console app) that should
show you how to use the IP lookup stuff...
Imports System.Net
Imports System.Net.Sockets
Imports System.Reflection.Assembly
Module modCore
Sub Main(ByVal cmdArgs() As String)
Dim iTotalParms As Integer = 0
iTotalParms = (UBound(cmdArgs) + 1)
Console.WriteLine("{0} {1}.{2}.{3} Copyright (C) 2004 Joseph N.
Stackhouse", _
GetExecutingAssembly.GetName.Name, _
GetExecutingAssembly.GetName().Version.Major.ToStr ing(), _
GetExecutingAssembly.GetName().Version.Minor.ToStr ing(), _
GetExecutingAssembly.GetName().Version.Build.ToStr ing())
Console.WriteLine()
If (iTotalParms) <> 1 Then
Console.WriteLine("Usage: {0} <hostname>",
GetExecutingAssembly.GetName.Name)
End
End If
Dim iTotalResults As Integer = 0
Dim sIPs() As String
Dim sNames() As String
Dim DNSLookup As Dns
Dim HostLookup As Dns
Dim IPResult As New IPHostEntry
Try
IPResult = DNSLookup.GetHostByName(cmdArgs(0))
Catch ex As SocketException
Console.WriteLine("Could not resolve [{0}]:", cmdArgs(0))
Console.WriteLine()
Console.WriteLine(ex.Message)
End
Catch ex As System.ArgumentOutOfRangeException
Console.WriteLine("Cannot process your request as one or more
segments of the address you specified exceed the maximum length allowed")
End
End Try
iTotalResults = UBound(IPResult.AddressList)
Console.WriteLine("Found a total of {0} addresses for [{1}]:",
(iTotalResults + 1).ToString, cmdArgs(0))
Console.WriteLine()
ReDim sIPs(iTotalResults)
ReDim sNames(iTotalResults)
Dim i As Integer = 0
Do While i <= UBound(IPResult.AddressList)
sIPs(i) = (IPResult.AddressList(i).ToString())
Try
sNames(i) =
HostLookup.GetHostByAddress(sIPs(i)).HostName.ToSt ring
Catch ex As Sockets.SocketException
If sNames(i) = vbNullString Then sNames(i) = "none"
End Try
Console.WriteLine("{0}.{1}{2}{3}({4})", (i + 1).ToString, vbTab,
sIPs(i), vbTab, sNames(i))
i += 1
Loop
End Sub
End Module
Alternatively you can download it from Planet Source Code at:
http://www.pscode.com/vb/scripts/Sho...txtCodeId=1287
-L
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Michael,
In addition to the other's comments:
My understanding is IPAddress.Address is obsolete as it does not support
IPv6. (internet addresses longer then 32bits).
As Daniel suggested, the GetAddressBytes call supports addresses longer
then 32bits!
Hope this helps
Jay
"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl... Does anyone know why this property is obsolete? Also, is there an
alternative available?