473,569 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding network names

Hi,

I'm making am app that check which IP is currently use on my network, but I
would like to be able to find out the name of the computer to whom the IP
belong, and I can not find out how to do it using VB Express 2005

--
Thank You in Advance
Merci a l'avance

Martin

Sep 15 '07 #1
3 2760
"Martin Racette" wrote:
Hi,

I'm making am app that check which IP is currently use on my network, but I
would like to be able to find out the name of the computer to whom the IP
belong, and I can not find out how to do it using VB Express 2005

--
Thank You in Advance
Merci a l'avance

Martin
Please have a look at the class System.Net.DNS. If you use the function
GetHostEntry you get an IPHostEntry. The property 'HostName' (of the
IPHostEntry) should be the value that you are looking for.
If you prefer to put this functionality into an own thread, you can use
BeginGetHostEnt ry and EndGetHostEntry instead.
Sep 16 '07 #2
Thank you for the information, but I do not how I can pass the IP address
so that can find out the name that is associated with it

If you could clarify how to build such a function I would appreciated.

BTW I did check the online help, and I just get more confuse by it

"Oliver Tell" <Ol********@dis cussions.micros oft.comwrote in message
news:4F******** *************** ***********@mic rosoft.com...
"Martin Racette" wrote:
>Hi,

I'm making am app that check which IP is currently use on my network, but
I
would like to be able to find out the name of the computer to whom the IP
belong, and I can not find out how to do it using VB Express 2005

--
Thank You in Advance
Merci a l'avance

Martin
Please have a look at the class System.Net.DNS. If you use the function
GetHostEntry you get an IPHostEntry. The property 'HostName' (of the
IPHostEntry) should be the value that you are looking for.
If you prefer to put this functionality into an own thread, you can use
BeginGetHostEnt ry and EndGetHostEntry instead.
--
Thank You in Advance
Merci a l'avance

Martin

Sep 18 '07 #3
"Martin Racette" wrote:
>
Thank you for the information, but I do not how I can pass the IP address
so that can find out the name that is associated with it

If you could clarify how to build such a function I would appreciated.

BTW I did check the online help, and I just get more confuse by it

Ok, I have just done a little coding. To run it, you'll need a form and a
button (form1 and button1).

Imports System.Net

Public Class Form1

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
'With the next line you choose the IP address you want to test.
Dim myBytes() As Byte = {192, 168, 0, 241}
Dim TestIP As New IPAddress(myByt es)
Dim msg As String = ""
Dim ComputerName As String = ""
ComputerName = IP_to_Name(Test IP)
Select Case ComputerName.Le ngth
Case 1 To 99
msg = "The computer with the IP Address " & TestIP.ToString
& " is named : " & ComputerName
Case 0
msg = "IP Address " & TestIP.ToString & " is not online at
the moment."
End Select
MsgBox(msg)
End Sub

Private Function IP_to_Name(ByVa l an_IP_address As IPAddress) As String
Try
Return Dns.GetHostEntr y(an_IP_address ).HostName
Catch ex As Exception
'MsgBox(ex.ToSt ring)
Return ""
End Try
End Function

End Class
Sep 18 '07 #4

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

Similar topics

4
2174
by: Charles A. Lackman | last post by:
Hello I have created a Dataview and have sorted it on the Date and ShiftNumber columns this works great, but when I want to use the Find Method it gives me the following error: Expecting 2 value(s) for the key being indexed, but received 1 value(s). I have tried the following: Dim Names(1) as Object
0
1267
by: Aws | last post by:
Hi Friends How to programmatically read The Names of a Network Domains, The Number and Names of the Workstations Connected to a specific Domain! I am using the WMI in VS.NET, and want to know how to read all the network domains available in my network. Would be also nice to be able to read all the WorkStation connected (physical...
6
8225
by: Job Lot | last post by:
Using VB.NET how can I find all available SQL Server on a local network and list all the databases in each server. Thanks
8
3360
by: Stephen K. Young | last post by:
If you have not seen it, this recent Microsoft Knowledge Base article is worth reading: http://support.microsoft.com/kb/889588 "How to optimize Office Access and Jet database engine network performance
1
2928
by: Naveen Mukkelli | last post by:
Hi, I've got 3 Network Interface Cards(NIC) in my PC. Lets say NIC1, NIC2, NIC3. I have openend network connections in control panel and renamed them to Network 1, Network 2, Network 3. I'm trying to get these names( Network 1, Network 2, Network 3) by using C#. When I tried using Win32_NetworkAdapterConfiguration class, I could get the...
8
2221
by: Steven Van Dyke | last post by:
Hi I need a code snippet to determine if my computer is connected to a network or not. There's probably a System.Net function for it, but I cannot find it. Thanks, Steve
2
2156
by: Thomas Müller | last post by:
Hi, I need a way to find the names of the computers that are reachable over a network. Ideally when it is executed it should report back wich computernames are present. I have seen one solution with System.DirectoryServices but that doesn't work for me because the required isn't installed on the computer.
0
1873
by: NSF12345 | last post by:
Iv developed a small program that looks for a file over our network, and copy it to the location of another computer. Im using the "If FileExists("\\oldpc\main share\Folder\file.txt") Then" way of finding if the file exists, but i want to make it so that it tries to look for the computer, not the file. At the moment this is how i am finding and...
1
14193
by: Glenton | last post by:
Hi All Here is a very simple little class for finding a shortest route on a network, following Dijkstra's Algorithm: #!/usr/bin/env python #This is meant to solve a maze with Dijkstra's algorithm from numpy import inf from copy import copy
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.