> > Hi Pete,
> >
> > I believe there is a ping dll on the
west-wind.com. Don't know if it's free. You can also try the west-wind site monitor, an app that is designed to send an email as soon as it can't connect to a (web?) computer.
> > --
> > Eric den Doop
> >
www.foxite.com - The Home Of The Visual FoxPro Experts
>
> Hi Pete!
> just try this, try to add foxrun.pif and complist.txt (just save any blank notepad file as complist.txt ) on the default directory
>
>
> CREATE CURSOR netComps(computer c(254))
> DECLARE INTEGER WinExec IN win32api AS custrun ;
> STRING command, INTEGER param
>
> =custrun("foxrun.pif /C net view > complist.txt",0)
>
> FILETOSTR("complist.txt")
> *Find out if coms on networks are alive.
> *Parse a FILETOSTR() file to find the active computers on the network.
> DIMENSION laCompList[OCCURS("\\",FILETOSTR("complist.txt")),2]
> FOR lnx = 1 TO OCCURS("\\",FILETOSTR("complist.txt"))
> lcCompName = SUBSTR(FILETOSTR("complist.Txt"),AT("\\",FILETOSTR("complist.Txt"),lnX)+2,7)
> laCompList[lnX,1] = lcCompName &&Save the computername to the array
>
> cComputer = "\\" +ALLTRIM(lcCompName)+[\C\]
> SELECT netComps
> APPEND BLANK
> replace computer WITH cComputer
> ENDFOR
>
> sele netComps
> brow normal
>
Hi,
Thanks moochos guys, but I have to test to see if the workstations are in fact on line every
5 minutes. The net list gives me a listing of all workstations, and when I tested with a workstation
shut off, the net list still pulled the computer name.
Finally, ended up with writing the following short function to verify if in fact a workstation is
logged into the network:
* --- PingPC() function - To return .T. if workstation sensed on the
* --- network and .F. if it is not sensed.
* --- Programmer : Peter Sass
* --- Date : 2003.04.29
* --- Target OS : Windows 2000
FUNCTION PingPC
LPARAMETERS cCompName, lPCthere
DECLARE INTEGER WinExec IN win32api AS custrun ;
STRING command, INTEGER param
* --- Run the ping command and target to "pingpc.txt" file.
=custrun("foxrun.pif /C ping &cCompName > pingpc.txt",0)
* --- Wait for 10 seconds for ping to return data into txt file.
WAIT "" TIMEOUT 10
* --- Convert the contents of the complist.txt to a string
pingstring=FILETOSTR("pingpc.txt")
* --- If ping fails and returns "Unknown host" the workstation
* --- is not logged into the network, or does not exist.
IF AT("Unknown host",pingstring) > 0
lPCthere = .F.
ELSE
lpcthere = .T.
ENDIF
* --- Return true, or false to from this call.
RETURN lPCthere
* --- End of PingPC function --------------------------------------------- *
This seems to do it for me. Slight delay waiting to ensure ping data is returned,
but seems to run fine as testing every 15 minutes to ensure these computers are
still on line.
Pete from the Great White North. (Only in Canada, ay.) Over and Out ...