Re: problems re-reading from socket

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

 



On Fri, 24 Nov 2006 13:41:59 -0600 (CST), "Richard Lynch" <ceo@xxxxxxxxx> wrote:
> On Fri, November 24, 2006 1:21 pm, Martin Marques wrote:
>> I have a daemon class which reads and answers using socket_read and
>> socket_write functions. The things is that I connect to the daemon,
>> sent a chain and the I get an answer, but after that the daemon get's
>> struck in the next socket_read.
> 
> Have you set:
> http://www.php.net/manual/en/function.socket-set-nonblock.php

If I set non-blocking, I get endless warnings when trying to accept connexions:

Warning: socket_accept(): unable to accept incoming connection [11]: Resource 
temporarily unavailable in /usr/local/php/offline/lib/daemonSocket.inc on line 100
socket_accept() failed: reason: Success

> It seems to me that if you don't, you are going to wait for 2048
> bytes, no matter how little/much data is there...

>From the socket_read manual:

 The function socket_read() reads from the socket resource socket created by the 
socket_create() or socket_accept() functions. The maximum number of bytes read 
is specified by the length parameter. Otherwise you can use \r, \n, or \0 to end 
reading (depending on the type parameter, see below).

I'm using PHP_NORMAL_READ BTW.

--
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' || 
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador, 
    del Litoral             |   Administrador
---------------------------------------------------------

-- 
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