tags:

views:

398

answers:

5

Is it possible to implement a p2p using just PHP? Without Flash or Java and obviously without installing some sort of agent/client on one's computer.

so even though it might not be "true" p2p, but it'd use server to establish connection of some sort, but rest of communication must be done using p2p

i apologize for little miscommunication, by "php" i meant not a php binary, but a php script that hosted on web server remote from both peers, so each peer have nothing but a browser.

A: 

Doesn't peer-to-peer communication imply that communication is going directly from one client to another, without any servers in the middle? Since PHP is a server-based software, I don't think any program you write on it can be considered true p2p.

However, if you want to enable client to client communications with a php server as the middle man, that's definitely possible.

tj111
Downvoted for false information. PHP is not server-based.
Jan Jungnickel
Although, to run PHP scripts locally you would need to install a PHP interpreter, and if the OP doesn't want to install Flash or Java, I doubt they will want to install PHP locally
chrisbunney
+2  A: 
David Dorward
+1  A: 

without installing some sort of agent/client on one's computer

Each computer would have to have the PHP binaries installed.

EDIT

I see in a different post you mentioned browser based. Security restrictions in javascript would prohibit this type of interaction

Eddy
A: 

Depends on if you want the browser to be sending data to this PHP application.

I've made IRC bots entirely in PHP though, which showed their status and output in my web browser in a fashion much like mIRC. I just set the timeout limit to infinite and connected to the IRC server using sockets. You could connect to anything though. You can even make it listen for incoming connections and handle them.

What you can't do is to get a browser to keep a two-way connection without breaking off requests (not yet anyways...)

Blixt
A: 

No, not really. PHP scripts are meant to run only for very small amount of time. Usually the default maximum runtime is two minutes which will be normally not enough for p2p communication. After this the script will be canceled though the server administrator can deactivate that. But even then the whole downloading time the http connection between the server and the client must be hold. The client's browser will show in this time its page loading indicator. If the connection breakes most web servers will kill the php script so the p2p download is canceled.

So it may be possible to implement the p2p protocol, but in a client/server scenario you run into problems with the execution model of php scripts.

sebasgo