I have a socket client that would read data from the server.
However, it does not leave the do..while loop as soon as there are no more data left to read? why is that so? Thanks
while (true)
{
$data_old=$data;
$data = file_get_contents("userInput.txt");
if($data_old != $data)
{
socket_write($socket, $data, strlen($data));
do
{
$line =@socket_read($socket,2048);
echo $line. "\n";
}
while($line != "");
}
}
i solved it using another method. By my server sending a (” “) statement to the client after all the data has been sent.
Client side will then exit that loop upon receiving the statement.