Created
March 22, 2012 14:54
-
-
Save jpauli/2158791 to your computer and use it in GitHub Desktop.
Simple PHP chat using nc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$p = proc_open("/bin/nc -l -p 11111", array (STDIN, array("pipe", "w"), array("file", "/dev/null", 'w')), $pipes); | |
while (1) { | |
$read = array($pipes[1]); | |
$write = $except = null; | |
stream_select($read, $write, $except, 2); | |
echo fgets($pipes[1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment