Created
October 11, 2012 19:02
-
-
Save andriesss/3874752 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public function getChangedReadStreams() | |
{ | |
$read = array($this->socket); | |
$write = array(); | |
$except = array(); | |
return stream_select($read, $write, $except, 5); | |
} | |
/** | |
* @return bool|string | |
*/ | |
public function read() | |
{ | |
$done = false; | |
$response = ''; | |
while (!$done) { | |
$response .= fread($this->socket, 4096); | |
if ($this->getChangedReadStreams() == 0) { | |
$done = true; | |
} | |
} | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment