Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/SystemConfiguration/Reachability
Function:
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/SystemConfiguration/Reachability
This example is the version from Wed, 15th May 2012.
Project "Reachability.rbp"
FileTypes
Filetype text
End FileTypes
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 StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open() const ip="192.168.1.1" const name="www.apple.com" dim s as SystemConfigurationMBS dim f as integer s=new SystemConfigurationMBS StaticText1.text=ip StaticText2.text=name StaticText3.text="?" StaticText4.text="?" i=new Reachability i.text=StaticText3 StaticText3.text="ok" if i.CreateWithAddress(ip) then 'ok else StaticText3.text="fail" end if n=new Reachability n.text=StaticText4 StaticText4.text="ok" if n.CreateWithName(name) then 'ok else StaticText4.text="fail" end if if s.NetworkCheckReachabilityByAddress(ip,f) then StaticText6.text=app.Flags(f) else StaticText6.text="fail" end if if s.NetworkCheckReachabilityByName(name,f) then StaticText7.text=app.Flags(f) else StaticText7.text="fail" end if End EventHandler
Property Protected i As reachability
Property Protected n As reachability
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
Function Flags(flags as integer) As string const kSCNetworkFlagsTransientConnection =1 const kSCNetworkFlagsReachable = 2 const kSCNetworkFlagsConnectionRequired = 4 const kSCNetworkFlagsConnectionAutomatic = 8 const kSCNetworkFlagsInterventionRequired = 16 const kSCNetworkFlagsIsLocalAddress = 65536 const kSCNetworkFlagsIsDirect = 131072 dim s as string if BitwiseAnd(flags, kSCNetworkFlagsTransientConnection)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"TransientConnection" end if if BitwiseAnd(flags, kSCNetworkFlagsReachable)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"Reachable" end if if BitwiseAnd(flags, kSCNetworkFlagsConnectionRequired)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"ConnectionRequired" end if if BitwiseAnd(flags, kSCNetworkFlagsConnectionAutomatic)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"ConnectionAutomatic" end if if BitwiseAnd(flags, kSCNetworkFlagsInterventionRequired)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"InterventionRequired" end if if BitwiseAnd(flags, kSCNetworkFlagsIsLocalAddress)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"IsLocalAddress" end if if BitwiseAnd(flags, kSCNetworkFlagsIsDirect)<>0 then if s<>"" then s=s+", "+chr(13) end if s=S+"IsDirect" end if if s<>"" then s=s+", "+chr(13) end if s=s+str(flags) Return s End Function
End Class
Class Reachability Inherits SCNetworkReachabilityMBS
EventHandler Sub Changed(flags as integer) text.text=app.Flags(flags) End EventHandler
Property text As Label
End Class
End Project

Feedback, Comments & Corrections

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





Links
MBS FileMaker tutorial videos