Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66994 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46211 invoked from network); 6 Apr 2013 06:36:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Apr 2013 06:36:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=chobieee@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chobieee@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.173 as permitted sender) X-PHP-List-Original-Sender: chobieee@gmail.com X-Host-Fingerprint: 209.85.192.173 mail-pd0-f173.google.com Received: from [209.85.192.173] ([209.85.192.173:44098] helo=mail-pd0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/00-45934-172CF515 for ; Sat, 06 Apr 2013 01:36:34 -0500 Received: by mail-pd0-f173.google.com with SMTP id v14so2127536pde.18 for ; Fri, 05 Apr 2013 23:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=xbK9vQ01VteIcmlYPVOOWPUH1Sn67ewEPH8cVrMxgpQ=; b=e+JWjKSw1aQbn/0wLd9nLzwtnIHjMwEZedC7aCGao0OqdvWPB7QVL6Z+pHWUnH/wQm lo2Bi1GeDmEDHTq6T7fvHtI51sDRr437WF1lall29ZZmn+XCRpI04H3k1imtQUbVvbrY gdNOWsh64u5chn5JcXtNEBs/dGV0FQRq6UzdyJAE2Frvvl9jVFM4TRY46sBed9b5hfUu kWx/Qrbq+H7/SZUeHwACfW+woN5If7R29vkpwJG8GY2qibYM5joK7stcUjRCqF5syHnj xWkLjrzbCLFQWjtxIbA4jsUfybYHTac4EaROoiw1ZDUWdR14BbYwAuXpvxnB5pA9lJyk Pjfw== MIME-Version: 1.0 X-Received: by 10.68.213.167 with SMTP id nt7mr17796914pbc.194.1365230191217; Fri, 05 Apr 2013 23:36:31 -0700 (PDT) Received: by 10.68.73.130 with HTTP; Fri, 5 Apr 2013 23:36:31 -0700 (PDT) In-Reply-To: References: Date: Sat, 6 Apr 2013 15:36:31 +0900 Message-ID: To: Gustavo Lopes Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8ff1c6e495957604d9ab6c18 Subject: Re: [PHP-DEV] how to determine errno on user space? From: chobieee@gmail.com (chobie) --e89a8ff1c6e495957604d9ab6c18 Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > On Tue, 02 Apr 2013 02:11:24 +0200, chobie 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 > --e89a8ff1c6e495957604d9ab6c18--