I'm working on using PHP for socket connections. The main problem I'm having is that if I fgets() for an amount of more than is in the buffer, the script will hang.
The PHP manual says to use
while(!feof($socket))
{
echo fgets($socket, 1024);
}
to read multiple lines, but this seems to not work, because once fgets reads over what is in the socket, it hangs waiting for more. I am aware of the set nonblocking, but that will not work either, because I have to wait for the server to respond anyways.
Is there any way to get around this? I started having this problem when I was trying to read multiple lines of input. All I need to be able to do is read all the lines of input from the socket without it hanging. Any help with this will be greatly appreciated!!
Thanks in advance for any help.