To obtain ip address

To obtain ip address

Postby MarcoBoschi » Thu Nov 04, 2010 8:44 am

Hi,

I need a function that if I pass mac address it returns to to me ip address.
Is there anything?

Thanks in advance

marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: To obtain ip address

Postby ukoenig » Thu Nov 04, 2010 9:43 am

Hello Marco,

I think, this Tool will work for You ( Freeware )

Name2Ip2Mac

Image

http://www.softpedia.com/progDownload/N ... -4226.html

another one :

http://www.freewarezoom.com/archives/ip-sniffer

is a converter you can use on your PC for IP, MAC adresses and names.
Converts very fast:- ComputerNames into IpAddress or MacAddress- IpAddress into ComputerNames or MacAddressNote:
Some antivirus and antispyware programs flag Name2Ip2Mac as being infected/malware,
although the application is perfectly safe and does not pose a threat to your system...

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To obtain ip address

Postby MarcoBoschi » Thu Nov 04, 2010 10:32 am

Uwe,
thanks!
I was thinking about a function included in my program.
it is not essential but it would be nice.

Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: To obtain ip address

Postby ADutheil » Thu Nov 04, 2010 9:43 pm

Is the function below OK for you?

FUNCTION ChkIp( cMac )
LOCAL nMacs := fCreate( "macs.bat" )
LOCAL cBuff := ""
LOCAL lRetu := .F.

fWrite( nMacs, "arp -a >macs.lst" )
fClose( nMacs )
ShellExecute( 0, "open", "macs.bat",,, )
IF ( nMacs := fOpen( "macs.lst" ) ) > 0
WHILE hb_fReadLine( nMacs, @cBuff ) = 0
IF upper( cMac ) $ upper( cBuff )
msgInfo( "IP FOUND" + CRLF + allTrim( subStr( cBuff, 1, at( cMac, cBuff ) - 1 ) ) )
lRetu := .T.
EXIT
ENDIF
ENDDO
fClose( nMacs )
ELSE
msgStop( "UNABLE TO OPEN FILE MACS.LST" )
ENDIF
fErase( "macs.bat" )
fErase( "macs.lst" )
IF !lRetu
msgStop( "MAC " + cMac + CRLF + "IP NOT FOUND!" )
ENDIF
RETURN ( lRetu )

The cMac param must be sent as xx-xx-xx-xx-xx-xx
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: To obtain ip address

Postby MarcoBoschi » Fri Nov 05, 2010 4:24 pm

Ok Very good!
Many thanks
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: To obtain ip address

Postby James Bott » Fri Nov 05, 2010 5:42 pm

André,

Good job thinking outside the box. I like it!

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests