socket_write buffer problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi List

I am working with an application that has to run as a socket listener. It
receives a string from another application on a certain socket and then does
some processing and then passes the result back to the client application via
the socket. Here is the listener code I am using

while(true)
        {
                $client = socket_accept($socket);
                
                $arev_data = socket_read($client, 1024);
                
                $yresponse = build_XML_request($arev_data);
                
                socket_write($client, $yresponse);
                
                socket_close($client);
                
        }
        socket_close($socket);

The application is working fine but I have just noticed that when the $yresponse
variable is larger than 1024 bytes the string returned to the client is
truncated. I just had a look at the php manual for socket_write and it
mentions that truncating the data at the buffer size can be a problem. The
manual does not offer any possible solutions though. I am stumped here as the
value for $yresponse will often be larger than 1024 bytes and its length is
quite variable.

Does anyone have any suggestions on how I can make sure the entire contents of
$yresponse are passed back to the client?

  


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux