English 中文(简体)
Which programming languages can I use to write a Bonjour software?
原标题:

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.

问题回答

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.

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.

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.

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





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签