Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Bonjour/Bonjour
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MacOSX/Bonjour/Bonjour
This example is the version from Fri, 25th Feb 2010.
Notes: Last modified: Fri, 25th Feb 2010
Class Window1
Inherits Window
// Controls
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
// URL from Apple's docs
showurl "http://www.iana.org/assignments/port-numbers"
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
if r.Register(0,0,Rservicename.text,Rservicetype.text, Rdomain.text, "", val(Rport.text),"") then
MsgBox "Registering started successfull."
else
MsgBox "Registering failed."
end if

End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
if l.Lookup(0, lServicename.text,lservicetype.text, ldomain.text) then
MsgBox "Lookup started successfull."
else
MsgBox "Lookup failed."
end if
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
if b.Browse(0,bServicename.text,bdomain.text) then
MsgBox "Browse started successfull."
else
MsgBox "Browse failed."
end if
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim n as integer

if RadioEnumerate(0).Value then
n=128 // recommended registration domains
else
n=64 // browsing domains
end if

if e.EnumerateDomains(n,0) then
MsgBox "Enumerating started successfull."
else
MsgBox "Enumerating failed."
end if
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
r.Close
End Sub
End ControlInstance

// Properties
Dim b As myrendezvousbrowseMBS
Dim l As myRendezvouslookupMBS
Dim r As myRendezvousregisterMBS
Dim e As myrendezvousdomainEnumerationMBS

// Event implementations
Sub Close()
b.close
e.close
r.close
l.Close
End Sub
Sub Open()

b=new MyRendezvousBrowseMBS
r=new MyRendezvousRegisterMBS
e=new MyRendezvousDomainEnumerationMBS
l=new MyRendezvousLookupMBS

if b.Available then
write "Bonjour is available."
else

msgBox "No Bonjour found!"
quit

end if
End Sub

// Methods
Sub write(s as string)
listBox1.addrow s
listBox1.scrollPosition=listBox1.listcount
End Sub
End Class

Class MyRendezvousBrowseMBS
Inherits Object
// Event implementations
Sub ServiceBrowse(Flags as integer, InterfaceIndex as integer, ErrorCode as integer, ServiceName as string, RegType as string, Domain as string)
window1.write "ServiceBrowse event."
Window1.write " Name: "+ServiceName
Window1.write " Type: "+RegType
Window1.write " Domain: "+domain
Window1.write " Flags: "+str(flags)

End Sub
End Class

Class MyRendezvousDomainEnumerationMBS
Inherits Object
// Event implementations
Sub ServiceDomainEnumeration(flags as integer, interfaceIndex as integer, errorcode as integer, Domain as string)
Window1.write "ServiceDomainEnumeration event."
Window1.write " Domain: "+domain
Window1.write " Flags: "+str(flags)

End Sub
End Class

Class MyRendezvousLookupMBS
Inherits Object
// Event implementations
Sub ServiceLookup(flags as integer, InterfaceIndex as integer, ErrorCode as integer, Fullname as string, Hosttarget as string, Port as integer, TxtRecord as string)
window1.write "ServiceLookup event."
window1.write " IP: "+DNSNameToAddressMBS(Hosttarget)
window1.write " Port: "+str(port)
window1.write " Host: "+Hosttarget

End Sub
End Class

Class MyRendezvousRegisterMBS
Inherits Object
// Event implementations
Sub ServiceRegistration(flags as integer, errorcode as integer, Name as string, RegType as string, Domain as string)
window1.write "ServiceRegistration event."
window1.write " Errorcode: "+str(errorcode)
End Sub
End Class

Class App
Inherits Application
End Class


See also:




Links
MBS Filemaker Plugins - Pfarrgemeinde Ministranten Nickenich