This is a simple client that is running two different requests. One at every 2 seconds and another every 5 minutes. The 2 second one retrieved data from server and the 5 minute one sends data to server. <?php set_time_limit(0); ob_implicit_flush(); $host = “xxx.xxx.xxx.xxx”; $port = 1250; $lastUpdate = time(); while(1) { if(time() -… Continue reading PHP Socket Client
Tag: PHP Socket
PHP Socket Server – Running as Daemon and Multiple Connections
Code Courtesy: lars at opdenkamp dot eu A socket server written in PHP. This can accept multiple connections and runs as a daemon. pcntl_fork() is thing here that is making this all possible. <?php /** * Listens for requests and forks on each connection */ $__server_listening = true; //error_reporting(E_ALL); set_time_limit(0); ob_implicit_flush(); declare(ticks = 1); become_daemon();… Continue reading PHP Socket Server – Running as Daemon and Multiple Connections