WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Network Statistics - Bytes Received Sent


outputfile =  "C:\temp\Info.TXT"
RunShell(Environment("comspec"),StrCat("/c netstat -e > ",outputfile),"", @NORMAL, @WAIT)
;Parse Output file
; Looking for line:
; Bytes                     138189109        71163712
bytesrcvd = "" 
bytessent = ""
contents = Fileget(outputfile)
strptr = StrIndexNc (contents,"Bytes",1, @FWDSCAN)
crlfptr = StrIndexNc (contents,@CRLF,strptr+1, @FWDSCAN)
line = StrSub (contents, strptr, crlfptr-strptr)
count = ItemCount(line," ")
itemnum = 1
For x = 1 to count
	 item = ItemExtract(x,line, " ")
	 if item != ""
		 if itemnum == 2 then bytesrcvd = item
		 if itemnum == 3 then bytessent = item
		 itemnum = itemnum+1
	 endif
Next

Message("Network Statistics",StrCat("Bytes Received: ",bytesrcvd,@crlf, "Bytes Sent: ",bytessent))
FileDelete(outputfile)

exit

Article ID:   W16699
File Created: 2005:02:18:12:21:54
Last Updated: 2005:02:18:12:21:54