ConfigFile$ = "config.ini"
ReadMe$ = "read.me.txt"
flag = 0: set = 0: AlertLocation = 68: AlertLocationHigh = 10: ipstartline = 4
DownLog$
= "Down" + DATE$ + ".LOG" IF Char$
= "A" THEN flag
= 0: set
= 0 set = 1
LOCATE AlertLocationHigh
+ 2, AlertLocation
- 6:
PRINT "Hold A to clear" LOCATE AlertLocationHigh
+ 3, AlertLocation
- 10:
PRINT "Log=" + DownLog$
LOCATE AlertLocationHigh
+ 4, AlertLocation
- 10:
PRINT "Press L For Todays Log"
set = 2
LOCATE AlertLocationHigh
+ 2, AlertLocation
- 6:
PRINT " " LOCATE AlertLocationHigh
+ 3, AlertLocation
- 10:
PRINT " "
IF Char$
= "A" THEN flag
= 0: set
= 0 Title1$ = "Network up/down"
Title2a$ = "Press ESC to exit"
Title2b$ = "Press L For Todays Log"
Title2c$ = "Press E to edit IP list"
Title3$ = "Settings file (" + ConfigFile$ + ") found."
note$ = "File " + ConfigFile$ + " can be edited while the program runs. IPs scroll."
LOCATE AlertLocationHigh
- 1, AlertLocation
- 8:
PRINT Title2a$
LOCATE AlertLocationHigh
+ 4, AlertLocation
- 10:
PRINT Title2b$
LOCATE AlertLocationHigh
+ 5, AlertLocation
- 11:
PRINT Title2c$
IF Char$
= "A" THEN flag
= 0: set
= 0 set = 1
LOCATE AlertLocationHigh
+ 2, AlertLocation
- 6:
PRINT "Hold A to clear" LOCATE AlertLocationHigh
+ 3, AlertLocation
- 10:
PRINT "Log=" + DownLog$
LOCATE AlertLocationHigh
+ 4, AlertLocation
- 10:
PRINT "Press L For Todays Log"
set = 2
LOCATE AlertLocationHigh
+ 2, AlertLocation
- 6:
PRINT " " LOCATE AlertLocationHigh
+ 3, AlertLocation
- 10:
PRINT " "
IF Char$
= "A" THEN flag
= 0: set
= 0 COLOR 8, 15: b
= 5: c
= 2 'b moves IP and description status line over while c moves **/up/down around that line linelocate
= linelocate
+ 1:
IF linelocate
= 45 THEN linelocate
= 1 lineclear$
= "":
FOR lclear
= 1 TO 52: lineclear$
= lineclear$
+ " ":
NEXT LOCATE linelocate
+ ipstartline
, b:
PRINT "Ping ("; ip$;
") ("; desc$;
")";
IF Char$
= "A" THEN flag
= 0: set
= 0 ' Shell to ping and get results 0 up 1 down
result&
= _SHELLHIDE("ping " + ip$
+ " -n 1 -w 100") 'success
LOCATE , c:
PRINT "DN";
" Ping ("; ip$;
") ("; desc$;
")";
PRINT #2, DATE$ + " " + TIME$ + " " + "Ping (" + ip$
+ ") (" + desc$
+ ")" + " Down": flag
= 1: set
= 0 IF Char$
= "A" THEN flag
= 0: set
= 0 999
fill = 3
GetLocalIP$
= MID$(ipline$
, INSTR(ipline$
, ":") + 1) IF LEFT$(ipline$
, 3) = "169" THEN ipline$
= "Invalid IP" + ipline$
KILL "IPconfig.tmp" 'kill the messenger?
SUB example
(ConfigFile%
, ReadMe%
) PRINT #1, "192.168.1.1 Router" PRINT #1, "1.1.1.1 DNS Server" PRINT #1, "192.168.1.254 Wifi Access Point" PRINT #1, "qb64.com QB64.com (doesn't exist)" PRINT #1, "MUST include Ip, hostname or domain name and a description" PRINT #1, "Otherwise the program will not be able to ping properly." ReadMe$ = "read.me.txt"
PRINT #1, "Written by Chris Owen Chris.Owen09@gmail.com" PRINT #1, "This program came about from a necessity of keeping tabs on servers, switches, a router, a access point, and some printers, other windows pings were not able to accommodate my needs." PRINT #1, "Much thanks goes to FellippeHeitor for the starting code, after seeing how my first work was clumsy he pointed me to what this has become." PRINT #1, "visionmercer pointed out another ping parameter that I added as a tweak looking to make this fast as it can be." PRINT #1, "SMcNeill pointed out a flaw staring me in the face. In the interest of reduction of variables I knew I wanted to check INKEY values but by that I created a problem where a simpler approach was needed. Thanks" PRINT #1, "The Config.ini file shall contain all the ips you wish to monitor. It is recommended to edit it to your needs." PRINT #1, "The Config.ini file is dynamic so changes can be made without stopping the program, the file is read line by line and not all loaded at one time." PRINT #1, "This makes changing the file and reading the data in slower but you can monitor while changes are being done using a text editor." PRINT #1, "The program can ping, IPs, domain names and host names, descriptions are necessary. I used ( cmd Ping 1.1.1.1 -n 1 ) for the results" PRINT #1, "192.168.1.254 Wifi Access Point will be reported on the main screen as separate items using a UP or DN status." PRINT #1, "Since the program has to shell out to run the Cmd PING speed is slow so I have added a -n 1 count instead of the usual 3 count." PRINT #1, "This program will show 44 lines of ips, 45 and above will start a scroll effect and will pick up at the first ip in you list." PRINT #1, "Downed IPs are logged to a file called ( down????.log ) where ???? is the date it was noticed." PRINT #1, "In the log, simple details such as the date, time, and ip and if you put in a description are logged." PRINT #1, "ESC exits the program and holding the ( a ) key acknowledges any visual down notification." PRINT #1, "The program will self create missing files such as the Config.ini where the IPs are read from, and This read.me.txt file every run." PRINT #1, "You MUST include Ip, hostname or domain name and a description. Otherwise the program will not be able to ping properly." PRINT #1, "The pinger now changes color each completed loop so you can see its progress. On a fast computer with little overhead this thing is blazing." PRINT #1, "In addition to ESC and A to acknowledge I added E to launch notepad to edit the IP config file and L to launch the Log of the day." PRINT #1, "Tap the buttons a few times to launch The Inkey does not seem to catch even with them spread everywhere in the program." PRINT #1, "Added a search function for the IP that the machine is running on since I had a few issues with DHCP not working on a DDWRT that caused a headache. "