Hi List I have been banging my head against a wall all day trying to work this problem out. To recap my earlier post, I have a simple socket listener that handles the incoming string fine with socket_read and then it fires off the application as it should. When it returns the data to the socket only the first 1024 bytes get sent. I have done some testing and for the life of me I can not find a way to loop through the buffer. Everything I try still results in only the first 1024 bytes. Here is the code I have been trying while(true) { $client = socket_accept($socket); $arev_data = socket_read($client, 1024); $yresponse = build_XML_request($arev_data); if (strlen ($yresponse) < 1024) { socket_write($client, $yresponse); } else { while (strlen($yresponse) > 0) { if (strlen ($yresponse) > 1024) { $out = substr($yresponse, 0, 1024); socket_write($client, $out, strlen($out)); $yresponse = substr_replace($yresponse,'',0,1024); } else { socket_write($client, $yresponse); print "$yresponse "; $yresponse = substr_replace($yresponse,'',0,strlen($yresponse)); } } } socket_close($client); } Just for testing I cave an if statement that takes care of the case where there is a data string of less than 1024 bytes. The problem starts when I get into the else case where the$response is larger than 1024 bytes. The if statement seems OK and the first time through when the test data is 1521 bytes the first 1024 bytes gets returned by the socket_write. I then get rid of the first 1024 bytes of the string and the if statement falls through to the else as the string is now only 497 bytes left in the $ypsilon string. I see nothing returned to the client by the socket_write here however the print "$yresponse \n"; prints the data. I can not work out why the socket_write is not writing the data to the socket at this point. Does anyone have any clues? Regards, Richard Luckhurst Product Development Exodus Systems - Sydney, Australia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php