开发者

A PHP Socket Server with Flash Clients

How do I implement a PHP Socket Server, I am using PHP5.

Is there a ready made framework already available for me to use instead of going into the nitty gritties of the implementation details? Basically I want to serve Flash clients using this Socket Server and this would be running in an Apache Environment.

This is the fi开发者_开发知识库rst time I am treading into PHP territory so consider me a noob.


Have a look at Aleksey Zapparov's PHP Socket server

http://www.phpclasses.org/browse/package/5758.html

Its very simple to hange your own code off it. But be warned that you should be careful about your memory management. If you're writing a very complex OO app, then you should definitely install the ciercular reference checking garbage collector. And, since it use socket_select() you don't want ti to be hanging around too long witing for your code to do something.

Alternatively (if you are running on anything other than a Microsoft platform) it may be simpler to hang the php process off [x]inetd and just use stdio for communications.

HTH

C.


Check out Zend_AMF (emphasis mine)

Zend_Amf provides support for Adobe's » Action Message Format (AMF), to allow communication between Adobe's » Flash Player and PHP. Specifically, it provides a gateway server implementation for handling requests sent from the Flash Player to the server and mapping these requests to object and class methods and arbitrary callbacks.

  • http://framework.zend.com/download/amf
  • http://fritzthomas.com/php/zend-framework/329-zend_amf-update-and-examples/

and AMFPHP as an alternative.

Also, check out PHP Socket's API and check out this IBM Article about Memory Management with PHP.

Edit This is not server push though. PHP is not well suited for long running processes. If you want a push implementation, have a look at Comet technologies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜