Hi, I'm a bit of a newbie so apologies if this is very basic, I've searched for hours with no luck.
I have the following code that runs in a loop:
Code: Select all
fwrite($fp, $string."\r\n");
if (strpos(fread($fp, 128), $searchstring)) {
Do Something;
}
This runs fine, however the $searchstring I am looking for will occur in the first 40 bytes of the read string so I only really want to read the first 40 bytes. If I set the bytes to 40 the script runs for a few minutes and I then get:
Code: Select all
PHP Notice: fwrite(): send of 15 bytes failed with errno=104 Connection reset by peer
This error doesn't occur if the bytes are set to a figure higher than the actual string length (such as 128)
What is causing this error please and how can I stop it occurring.
Thanks, Bob.