[MacRuby-devel] Trying to add Bonjour to a ControlTower app

Mark Rada mrada at marketcircle.com
Sun Dec 12 20:09:42 PST 2010


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



More information about the MacRuby-devel mailing list