Platforms to show: All Mac Windows Linux Cross-Platform

/Linux/Avahi Browse Webservers
Function:
Required plugins for this example: MBS Linux Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Linux/Avahi Browse Webservers
This example is the version from Sun, 25th Aug 2012.
Project "Avahi Browse Webservers.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if MyClient.available = false then MsgBox "Please run on Linux with avahi installed." quit end if client = new MyClient Browser = new MyBrowser(client) call Browser.Browse(Browser.kInterfaceAny, Browser.kProtocolAny, "_http._tcp") End EventHandler
Property Browser As MyBrowser
Property Client As MyClient
Property Resolvers() As MyResolver
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyClient Inherits AvahiClientMBS
EventHandler Sub Failure(error as string, errorcode as integer) Log "Client Failure: "+error End EventHandler
EventHandler Sub Running() log "Running..." End EventHandler
End Class
Class MyBrowser Inherits AvahiBrowserMBS
EventHandler Sub Failure(error as string, errorcode as integer) Log "Browser Failure: "+error End EventHandler
EventHandler Sub ServiceFound(InterfaceIndex as integer, protocol as Integer, name as string, type as string, domain as string, flags as integer) Log "Found Service "+name+" at domain "+domain dim r as new MyResolver(Client) if r.Resolve(InterfaceIndex, protocol, name, type, domain, 0) then app.Resolvers.Append r end if End EventHandler
EventHandler Sub ServiceRemoved(InterfaceIndex as integer, protocol as Integer, name as string, type as string, domain as string, flags as integer) Log "Lost Service "+name+" of type "+type+" at domain "+domain // here you could stop resolvers started in the ServiceFound events End EventHandler
End Class
Class MyResolver Inherits AvahiResolverMBS
EventHandler Sub Failure(error as string, errorcode as integer) Log "Resolver Failure: "+error End EventHandler
EventHandler Sub Found(interfaceIndex as integer, Protocol as Integer, name as string, type as string, domain as string, hostname as string, port as integer, address as string, txt as string, flags as integer) log name + " at "+address+":"+str(port) End EventHandler
End Class
Module Module1
Sub Log(s as string) MainWindow.List.AddRow s MainWindow.List.ScrollPosition = MainWindow.List.ListCount End Sub
End Module
End Project

See also:

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS FileMaker Plugins

Start Chat