Isdestinationreachable Returning False Positives...
OK I'm at a loss here, I'm trying to simply determine if a computer is on the LAN with the following code:
Private Declare Function IsDestinationReachable Lib "SENSAPI.DLL" Alias "IsDestinationReachableA" (ByVal lpszDestination As String, ByRef lpQOCInfo As QOCINFO) As Long
Const NETWORK_ALIVE_AOL = &H4
Const NETWORK_ALIVE_LAN = &H1
Const NETWORK_ALIVE_WAN = &H2
Private Type QOCINFO
dwSize As Long
dwFlags As Long
dwInSpeed As Long 'in bytes/second
dwOutSpeed As Long 'in bytes/second
Private Sub cmdcheckip_Click()
Dim Ret As QOCINFO
Ret.dwSize = Len(Ret)
If IsDestinationReachable(txtcompname.Text, Ret) = 0 Then
MsgBox "The destination cannot be reached."
MsgBox "Machine " & txtcompname.Text & " was reached."
Private Sub cmdexit_Click()
Trouble is, with a lot of valid computer names it is still responding! If I put in some arbitrary name it returns false, so it seems like it is kind of working, but for a number of machines I have tested it on it will return true even if they are off! Anybody have any ideas?
Does 'IsDestinationReachable' API Call Support Network Address Translation
Could anybody please tell me if they know if 'IsDestinationReachable' API call support Network Address Translation ?
I have written a program in VB6 that needs to PING numerous PC's prior to mapping.
I am passing the IP address and QOCINFO as parameters for 'IsDestinationReachable', which works fine for the PC's not on the NAT'd network.
However the PING fails if the PC is using Network Address Translation.
I can ping the NAT'd IP address using the PING command, from the cmd prompt on my PC, so I know that the destination is reachable.
Any help would be very much appreciated on resolving this matter.
The code needs to be written in VB6.
Thanks in advance.