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.

4
  • Maybe this is more suited for stackoverflow
    – chmeee
    Commented Mar 4, 2010 at 10:22
  • Is it possible to shift it to stackoverflow?
    – Roman
    Commented Mar 4, 2010 at 10:31
  • And I was thinking this is a Hello World programming request :)
    – Pentium10
    Commented Mar 4, 2010 at 11:20
  • Which OS are you interested in? Your comments below suggest Windows. Commented Mar 4, 2010 at 13:21

4 Answers 4

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.

2
  • 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
    Commented Mar 4, 2010 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. Commented Mar 4, 2010 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.

2
  • 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
    Commented Mar 4, 2010 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
    Commented Mar 5, 2010 at 9: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.

1
  • I have installed Apple's Bonjour for Windows SDK. In the "Samples" folder there is "C", "CS", "Java", "VB". No PHP.
    – Roman
    Commented Mar 5, 2010 at 9: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.