Jump to content

Async PHP Sockets?


Rustywolf

Recommended Posts

Php doesn't allow the asynchronous socket callback functions of the same type used in other languages, so you need to write a loop that checks all the multiple connections and responds as and when they need attention.

 

Sockets can be told to act asynchronously with socket_set_nonblock. This will stop them pausing the code when a read or write is performed, if it can't then the read/write function just fails and moves on instead of waiting. There is also a function socket_select which simultaneously monitors whole arrays of sockets for read/write/exceptions.

Link to comment
https://forums.phpfreaks.com/topic/202569-async-php-sockets/#findComment-1061941
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.