Binary read is the correct way to read data in most cases, whereas "normal read", is a strange and lazy PHP built mode, that works mostly with terminal data.
If you want to keep track of closed connections with binary read, the correct way is NOT to switch from binary to "normal", like some suggests. The correct way is to create some test scenarios and see how PHP deals with specific circumstances.
Here is what a quick test shows, when working with non-blocking sockets.
<?php
$input = socket_read($socket, 1024);
if ($input === FALSE || strcmp($input, '') == 0) {
$code = socket_last_error($socket);
socket_clear_error($socket);
if ($code == SOCKET_EAGAIN) {
} else {
}
} else {
}
?>
There are more errors to consider, but this will get you started.