Platforms to show: All Mac Windows Linux Cross-Platform
/MacOSX/Bonjour/Bonjour Old
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MacOSX/Bonjour/Bonjour Old
This example is the version from Fri, 25th Feb 2010.
Notes: Last modified: Fri, 25th Feb 2010
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MacOSX/Bonjour/Bonjour Old
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
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(Rservicename.text,Rservicetype.text, Rdomain.text, val(Rport.text),Rtext.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(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(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=1 // recommended registration domains
else
n=0 // recommended browsing domains
end if
if e.EnumerateDomains(n) 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
ControlInstance
Sub Action() Handles Event
dim s as string
// a TXT Record is built of Pascal Strings
// one byte for len + content
// you can attach severals, but it should be only 100 bytes or so
// see http://www.zeroconf.org/Rendezvous/txtrecords.html
s=Rtext.text
s=chr(len(s))+s
title=str(r.UpdateText(s,200000))
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 "Rendevouz is available."
else
msgBox "No Rendevouz found!"
quit
end if
if TargetWin32 then
MsgBox "The Old DNSServiceDiscovery API does work on Mac OS X 10.2, but not on Windows."
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(message as integer, name as string, type as string, domain as string, flags as integer)
window1.write "ServiceBrowse event."
Window1.write " Name: "+name
Window1.write " Type: "+type
Window1.write " Domain: "+domain
Window1.write " Flags: "+str(flags)
Window1.write " Message: "+str(message)
End Sub
End Class
Class MyRendezvousDomainEnumerationMBS
Inherits Object
// Event implementations
Sub ServiceDomainEnumeration(message as integer, domain as string, flags as integer)
Window1.write "ServiceDomainEnumeration event."
Window1.write " Domain: "+domain
Window1.write " Flags: "+str(flags)
Window1.write " Message: "+str(message)
End Sub
End Class
Class MyRendezvousLookupMBS
Inherits Object
// Event implementations
Sub ServiceLookup(ip as string, port as integer, text as string, flags as integer)
window1.write "ServiceLookup event."
window1.write " IP: "+ip
window1.write " Port: "+str(port)
window1.write " Text: "+text
End Sub
End Class
Class MyRendezvousRegisterMBS
Inherits Object
// Event implementations
Sub ServiceRegistration(errorcode as integer)
window1.write "ServiceRegistration event."
window1.write " Errorcode: "+str(errorcode)
End Sub
End Class
Class App
Inherits Application
End Class
See also:
Links
MBS Realbasic PDF Plugins - Pfarrgemeinde St. Arnulf Nickenich