|
-
Jul 6th, 2004, 12:35 PM
#1
Thread Starter
New Member
code for getting the system names in a lan
I want VB.NET code for getting the systems names and ip addresses in a lan
-
May 25th, 2006, 03:37 AM
#2
-
May 25th, 2006, 03:42 AM
#3
Re: code for getting the system names in a lan
(Import System.NET first)
Dim strHost As String
strHost = Dns.GetHostName()
Dim iphe AS IPHostEntry
iphe = Dns.GetHostByName(strHost)
-
May 25th, 2006, 12:17 PM
#4
Re: code for getting the system names in a lan
mendhak's code only gets the ip address and hostname of the machine that the code is running on
-
May 25th, 2006, 12:45 PM
#5
Re: code for getting the system names in a lan
Hi,
Use the System.Net.DNS class, which provides de shared GetHostName and GetHostByName methods.
Try this;
VB Code:
Dim HostName As String
Dim IPAddress As String
' Look up the host name and Ip address
HostName = System.Net.Dns.GetHostName()
IPAddress = System.Net.Dns.GetHostByName(HostName).AddressList(0).ToString()
Console.WriteLine("Host name:" & HostName)
Console.WriteLine("IP address:" & IPAddress)
Hope it helps,
sparrow1
-
May 25th, 2006, 10:53 PM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|