Socket Programming in php -


this question has answer here:

i have code client , server socket programming.. in server.php file, reading data client , uploading same data mysql.

$input = socket_read($spawn, 1024) or die("could not read input\n"); $sql= "insert data values ('$input')"; 

the server code running whenever call url in browser. need run server program continuously 24x7. should in particular case. offering hosting along sockets. in case not need run server.php in browser? or there other way?

you can use while true loop sure use blocking mode socket (socket_set_block()) or @ least sleep() inside loop not penetrate server ;)

then there many options run script on server in screen session, backgrounded process or use tool start-stop-deamon etc...

of course need regularly check if ie. using cron , restart process if required etc...


Comments