Visual Basic .NET Forums    

Go Back   Visual Basic .NET Forums > Components & Controls > Net / Sockets

VB.NET Forums Newsletter Signup:
Email address:


Net / Sockets Components for network and related use

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-23-2008, 11:44 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Sep 2008
Posts: 2
Reputation: 0
_powerade_ is on a distinguished programming path ahead
Default Find names on devices in a network

Hi,

I'm currently working on an application that first pings and then, if something "pings back", checks the ip-address using the GetHostEntry statement. If a device is connected at ex. IP 192.168.1.50, it pops up on a list.

But I was wondering... Is it possible to get the name of that device? GetHostEntry only gives me the IP-address (unless its a computer, then the computer name pops up) if it find a router, modem, a mobile device etc...

For example: I have a dreambox connected on my network. Is there a way to get the name of the dreambox when i know its ip??? Or my Nokia? Or my wireless printer???

I'm uploading a picture of the application so you might better understand what i mean.

PS: The text in the application is in Norwegian...
Attached Images
File Type: jpg pinger, eksempel.jpg (57.0 KB, 16 views)
__________________
best regards _ powerade_
Reply With Quote
  #2 (permalink)  
Old 09-24-2008, 10:07 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 36
Posts: 7,894
Reputation: 819
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

There could possibly be other ways and information when DNS host name is not available, but these could also mean more device specific interfacing. One global option is to get the MAC address, the first 3 bytes of these 6 is something called OUI (Organizationally Unique Identifier) and there exist a public list where you can at least find out which manufacturer produced the NIC, the other 3 bytes probably only each manufacturer known what means. Here is an example I have tested and which worked, you need this declaration:
Quote:
Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIP As Integer, ByVal SrcIP As Integer, ByRef pMacAddr As Long, ByRef PhyAddrLen As Integer) As Integer
The OUI list can be downloaded from IEEE.org.

Sample code to get MAC and OUI:
Code:
Dim ip As Integer = CInt(Net.IPAddress.Parse("192.123.45.67").Address)
Dim mem As Long
Dim ret As Integer = SendARP(ip, 0, mem, 6)
Dim ab() As Byte = BitConverter.GetBytes(mem)
Dim OUI As String = BitConverter.ToString(ab, 0, 3)
Nevermind the Address obsolete warning, also Vista runs IP4 compatibility translation.

With the OUI string you can search the text file or create yourself a smaller lookup table from it. When successful it is for example more useful to know this manufacturer name "CANON INC." than only the IP.
__________________
See this thread about how to use forum markup codes for code blocks etc (present the problem/post properly )
Some useful links: Learning videoes, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ


DR. WEIR: Download it to a non-networked, firewalled computer.
TECHNICIAN: Yes, ma'am.
Reply With Quote
  #3 (permalink)  
Old 09-25-2008, 8:44 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Sep 2008
Posts: 2
Reputation: 0
_powerade_ is on a distinguished programming path ahead
Default

Thanks a lot JohnH

This solved the problem.
__________________
best regards _ powerade_
Reply With Quote
Reply

Bookmarks


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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 3:01 PM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.