JC,
>
Actually, I want to see if an IP location of my local network is available ... if the machine is turned on, for example.
>
You can look for that machine mac address (network card identifier).
JC,
>
Actually, I want to see if an IP location of my local network is available ... if the machine is turned on, for example.
>
You can look for that machine mac address (network card identifier).
Antonio Linares wrote:You can look for that machine mac address (network card identifier).
Antonio Linares wrote:http://forums.fivetechsoft.com/viewtopic.php?t=12596
Julio,
> getHostByAddress( cNetAddress )
What value do you get for a connected computer ?
The way I commented you is for software protection, to check the server network card id.
Antonio Linares wrote:What value do you get for a connected computer ?
The way I commented you is for software protection, to check the server network card id.
Julio,
> this is an good way to testing the connection IP before connect!
Yes, it is ![]()
Antonio,
Ok, apparently works very fine! Thank you!
cIp:="192.168.0.164"
if empty( getHostByAddress( cIp ) )
MsgInfo("IP does not Exists")
else
MsgInfo("IP Exists")
EndifcIpAddress := "192.168.0.254"
cNetbiosName := "home_pc"
msgInfo( getHostByAddress( cIpAddress ) ) -> returns "home_pc"
msgInfo( getHostByName( nNetbiosName ) ) -> returns "192.168.0.254"Dear JC,
My requirement is same as yours. For eg. I would like to know whether a machine with the given IP is available in the network or not.
Just like when you give ping command in command prompt
For Eg: PING 192.168.0.151
If the machine with the IP 192.168.0.151 exists it will respond back ( Of course they can be firewall and antivirus rules not to respond back )
Regards
Anser
Anser,
You are right! The test with getHostByAddress() will be if is empty... so, we can understanding that machine owner of this ip is turned off or the ip is not valid. Like Antonio say...
if empty( getHostByAddress( "192.168.0.162" ) ) // Returning empty
MsgInfo("IP does not Exists")
else
MsgInfo("IP Exists")
Endif
if empty( getHostByName("PC1")) // Returning 0.0.0.0
MsgInfo("Name PC1 does not exist")
else
MsgInfo("Name PC1 Exists")
EndifC:\>ping PC1