3

Am I really restricted by programming languages? I can imagine that, to use Bonjour, I need to have special libraries which could be not available for any language. So, then I need to use those languages which have corresponding libraries. As the second option, I can imagine, that Bonjour provide an interface which can be used almost by any language (for example Bonjour saves information in a special file or in environment variables and than I can use most of the languages to access this information).

P.S. I have a particular interest in PHP.

Teddy
  • 6,013
  • 3
  • 26
  • 38
Roman
  • 124,451
  • 167
  • 349
  • 456

4 Answers4

2

Plenty of languages have ZeroConf bindings, including Java and .Net, and there's an example of using it in Python here. It uses D-Bus to talk to the daeomon. This list of bindings for D-Bus includes PHP, Python, Perl, Java, .Net, C++, Haskell, OCaml, Squeak, and plenty more besides. There's even a Pascal binding!

So no, you are not very restricted by programming languages.

Peter Westlake
  • 4,894
  • 1
  • 26
  • 35
  • Is D-Bus a software implementing zeroconf? Is it something like Bonjour? Or it should be (can be) used in addition to the Bonjour? In my particular case I need to use Bonjour. – Roman Mar 04 '10 at 11:56
  • D-Bus is a way for processes to talk to each other. So you would use a D-Bus library to talk to your Bonjour/ZeroConf service. It's a bit like COM. Since you are on Windows, you'll want to use COM, as Lachlan suggests. – Peter Westlake Mar 04 '10 at 17:04
1

You will have better luck searching for "ZeroConf", which is the name of the actual protocol, rather than "Bonjour", which is Apple's specific implementation of the protocol.

Teddy
  • 6,013
  • 3
  • 26
  • 38
  • Well, in my case I need to work with Bonjour (I know it will be installed on Windows XP and I need to use it). – Roman Mar 04 '10 at 11:22
  • ceejayoz, I need to use Bonjour. And I think this software has a special interface for "communication" with programming languages. And I think that another implementation of ZeroConf will have another interface. Isn't? I can be wrong. – Roman Mar 05 '10 at 09:26
1

Apple's Bonjour for Windows SDK is installed as a COM component, which can be called from PHP via the COM functions.

Sample code in several languages is installed with the SDK. While PHP is not one of them, the examples should be readable.

Another source of information on the API is the Bonjour documentation in the Mac OS X reference Library.

Lachlan Roche
  • 25,678
  • 5
  • 79
  • 77
  • I have installed Apple's Bonjour for Windows SDK. In the "Samples" folder there is "C", "CS", "Java", "VB". No PHP. – Roman Mar 05 '10 at 09:30
0

Roman, since you're particularly interested in PHP, you might checkout the php5-avahi extension: http://code.google.com/p/php5-avahi/

I've not used it yet (just begun researching this same question for myself), but it looks like what you're looking for: a way to write Bonjour (aka, Avahi, Zeroconf, Rendevous, mDNS) messaging/broadcasting/consuming in PHP.

Sadly, it looks like a fairly stagnant project (4 commits, all in 2009). Hopefully, though, it will help get you started.

Hope that helps, Benjamin

BigBlueHat
  • 2,355
  • 25
  • 30