How to check the Existence of IP Adress

  • Thread starter Thread starter Rajesh Kaki
  • Start date Start date
R

Rajesh Kaki

Hi,

I have written a VB6 Code to check for the Availability of IP Address before
assigning it to the machine.
I am using "GetRTTAndHopCount" Windows Function to check. But It is not
working in all cases.

Can any one please let me know Is there any other Function/way to perform
this Task.
Below is the code i have written.

Private Function CheckDuplicate(IPAddress as String) as Boolean
Dim lIPadr As Long
Dim lHopsCount As Long
Dim lRTT As Long
Dim lMaxHops As Long
Dim lResult As Long
Dim rst as String
lIPadr= inet_addr(IPAddress)

limaxHops=15

rst= (GetRTTAndHopCount(lIPadr, lHopsCount, lMaxHops, lRTT)=SUCCESS)

CheckDuplicate=rst
End Sub
 
The code you have posted would seem to be incomplete. What ever the case,
you might explore the IsDestinationReachable function found in the
Sensapi.dll.

Vinson
 
HI Vinson,

Thanks for your response. I tried this method but even this is also not
working in all cases. I tried giving the IP Address which are in use and it
worked correctly. And is also returning true for the machines which are
turned off.
Do we need to set any parameters like that.
 
Back
Top