Re: how to determine errno on user space?
The socket extension has another problem. it cannot create persistent
connection.
this is a big problem on large web application.
> As to your approach, I don't really like it. PHP does not have
enumerations, and the approach of creating a very large number of classes
for this purpose is unprecedented in the PHP codebase.
that approach is just came up and working sample. I'm looking for phpish
errno handling.
at least I need errno constants. you know errno depends platform. if I
hardcoded errno magic number on my library,
it works some platform but it might not work another platform (e.g
windows...)
I can choose to ignore errno on my library. but I'd like to improve PHP. as
PHP has libevent and some ev* extension
so adding errno feature is not a bad idea i think.
On Thu, Apr 4, 2013 at 6:34 AM, Gustavo Lopes <[email protected]>wrote:
> On Tue, 02 Apr 2013 02:11:24 +0200, chobie <[email protected]> wrote:
>
> Hi, I'm writing some socket client (fluentd client) with PHP and I have a
>> question.
>>
>> I want to retry fwrite or some socket function when I met recoverable
>> errno (e.g, EAGAIN). but PHP does not have any function to determine errno
>> as far as I known.
>>
>> what is the correct way to handle errno?
>> I'd like to write robust client with PHP but I don't have good idea to
>> determine errno.
>>
>>
> The sockets extension has socket_last_error() to get the errno value after
> the last operation on the passed in socket.
>
> The stream functions don't really handle this in a consistent fashion. For
> instance, stream_socket_client() can take a parameter by reference where to
> write the errno value, but other functions do not give such information and
> can only inform the user about the specific error that occurred via the a
> warning, which is not very friendly for programatically extracting the
> cause. I'd recommend that you use the sockets extension, unless you need
> encryption.
>
> As to your approach, I don't really like it. PHP does not have
> enumerations, and the approach of creating a very large number of classes
> for this purpose is unprecedented in the PHP codebase.
>
> --
> Gustavo Lopes
>
Thread (3 messages)