FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To obtain ip address
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

To obtain ip address

Posted: Thu Nov 04, 2010 08: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

Marco Boschi
info@marcoboschi.it
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: To obtain ip address

Posted: Thu Nov 04, 2010 09:43 AM
Hello Marco,

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

Name2Ip2Mac



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 :-)
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.
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: To obtain ip address

Posted: 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

Marco Boschi
info@marcoboschi.it
Posts: 368
Joined: Sun May 31, 2009 06:25 PM

Re: To obtain ip address

Posted: Thu Nov 04, 2010 09: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
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: To obtain ip address

Posted: Fri Nov 05, 2010 04:24 PM

Ok Very good!
Many thanks

Marco Boschi
info@marcoboschi.it
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: To obtain ip address

Posted: Fri Nov 05, 2010 05:42 PM

André,

Good job thinking outside the box. I like it!

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion