Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Darwin Network Interface Statistics


Required plugins for this example: MBS MacOSX Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Darwin Network Interface Statistics

This example is the version from Sun, 17th Mar 2012.

Project "Darwin Network Interface Statistics.xojo_binary_project"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control iTotal Inherits Label
ControlInstance iTotal Inherits Label
End Control
Control iTotalBytes Inherits Label
ControlInstance iTotalBytes Inherits Label
End Control
Control iDelta Inherits Label
ControlInstance iDelta Inherits Label
End Control
Control iDeltaBytes Inherits Label
ControlInstance iDeltaBytes Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control oTotal Inherits Label
ControlInstance oTotal Inherits Label
End Control
Control oDelta Inherits Label
ControlInstance oDelta Inherits Label
End Control
Control oTotalBytes Inherits Label
ControlInstance oTotalBytes Inherits Label
End Control
Control oDeltaBytes Inherits Label
ControlInstance oDeltaBytes Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() if stat.Update then ShowValues else me.Mode=0 // disable timer MsgBox "Failed to get statistic data!" end if End EventHandler
End Control
Control List Inherits ListBox
ControlInstance List Inherits ListBox
End Control
EventHandler Sub Open() first=true stat=new DarwinIFStatMBS if stat.Update then ShowValues end if End EventHandler
Sub ShowValues() dim InputBytes as UInt64 dim InputPackets as UInt64 dim OutputBytes as UInt64 dim OutputPackets as UInt64 dim d as DarwinIFStatInterfaceMBS dim i,c as integer c=stat.Count-1 for i=0 to c d=stat.Item(i) if d<>Nil then InputBytes=InputBytes+d.InputBytes OutputBytes=OutputBytes+d.OutputBytes InputPackets=InputPackets+d.InputPackets OutputPackets=OutputPackets+d.OutputPackets end if next oTotal.text=Format(OutputPackets,"-0") oTotalBytes.text=Format(OutputBytes,"-0") iTotal.text=Format(inputPackets,"-0") iTotalBytes.text=Format(inputBytes,"-0") if first then first=false // Show list of interfaces c=stat.Count-1 for i=0 to c d=stat.Item(i) if d<>Nil then List.AddRow d.Name List.cell(List.LastIndex,1)=hex(d.Type) end if next else oDelta.text=Format(OutputPackets-lastOutputPackets,"+0") oDeltaBytes.text=Format(OutputBytes-lastOutputBytes,"+0") iDelta.text=Format(inputPackets-LastInputPackets,"+0") iDeltaBytes.text=Format(inputBytes-lastinputBytes,"+0") end if LastInputBytes=InputBytes LastInputPackets=InputPackets LastOutputBytes=OutputBytes LastOutputPackets=OutputPackets End Sub
Property Protected LastInputBytes As UInt64
Property Protected LastInputPackets As UInt64
Property Protected LastOutputBytes As UInt64
Property Protected LastOutputPackets As UInt64
Property Protected first As boolean
Property Protected stat As darwinifStatmBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...