Hi Mark,_______________________________________________Instead of messing with sockets on your own, it's fairly easy to advertise and search for Bonjour services using the NSNetService and NSNetServiceBrowser APIs. If you bug me about it tomorrow, I could probably throw together a quick demo of how that would work (might even make a good addition to the sample/ directory).Cheers,JoshOn Dec 14, 2010, at 7:30 PM, Mark Rada wrote:Hi Laurent,_______________________________________________In my case I can ignore a lot of what the low level stuff since Control Tower handles it for me and I only to be able to advertise using Bonjour.Thanks for the update,MarkOn 2010-12-14, at 6:13 PM, Laurent Sansonetti wrote:Hi Mark,_______________________________________________I'm afraid the low level BSD socket structures are not yet covered by BridgeSupport.We could eventually add them to the libSystem BridgeSupport file, however I wonder if there isn't an easier way to use Bonjour from MacRuby.LaurentOn Dec 12, 2010, at 8:09 PM, Mark Rada wrote:Hi,
For a distributed web service I am trying to add Bonjour support, but I ran into trouble with the Bridge Support when trying out one of the examples from the NSNetServices Programming Guide[1].
When publishing, I am supposed to get some socket info from a BSD sockaddr structure[2], but I can't seem to cast the Pointer object to something useful. For example, when I try asking the Pointer for its type I get this:
NSSocketPort.alloc.init.address.bytes.type # => "C"
But it should be a struct with a short int and a char array. If I try to case the Pointer I get an error:
NSSocketPort.alloc.init.address.bytes.cast!( '{sockaddr=s[c]}' )
TypeError: unrecognized runtime type `{sockaddr=s[c]}'
I cannot find a Boxed class descendant for sockaddr or any of the structs it is unionized with, so I am wondering if anybody else has tried the Bonjour examples with MacRuby and had success? Are these low-level BSD libraries supported by the new Bridge Support?
Thanks,
Mark
Links:
1. http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
2. http://www.delorie.com/gnu/docs/glibc/libc_305.html
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel