Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51597 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44524 invoked from network); 7 Mar 2011 10:06:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2011 10:06:53 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:42714] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/05-17187-B3EA47D4 for ; Mon, 07 Mar 2011 05:06:52 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 09D0D70003CE for ; Mon, 7 Mar 2011 10:06:48 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id YUUZC51LVmMs for ; Mon, 7 Mar 2011 10:06:47 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id BC9837000441 for ; Mon, 7 Mar 2011 10:06:47 +0000 (WET) Received: from clk-0081.clk-domain (unknown [85.139.253.17]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id AC6B92008638 for ; Mon, 7 Mar 2011 10:06:47 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "internals@lists.php.net" References: <43.60.54597.484527D4@pb1.pair.com> <4D7436E8.7010802@sugarcrm.com> <4D74A2E0.3090304@sugarcrm.com> <4D74AAA3.9020307@sugarcrm.com> Date: Mon, 07 Mar 2011 10:06:47 -0000 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: <4D74AAA3.9020307@sugarcrm.com> User-Agent: Opera Mail/11.01 (Win32) Subject: Re: [PHP-DEV] [patch] allow socket_[gs]et_options() to work on streams From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") Em Mon, 07 Mar 2011 09:51:31 -0000, Stas Malyshev escreveu: >> I suppose this information could be queried, but would you want to do >> the cast and retrieve this data in every call say in a socket_read loop? > > I'd ask why you need socket_read and not just fread if you use streams? > If you need deeper semantics, then yes, either you use resources or you > convert. I'm not against the conversion function, per se, but the > regular API shouldn't force it's use (see below). That's a misleading argument. I could write a function that expects a socket resource and it would still work if passed a stream, but with degraded performance and functionality. The degraded functionality comes from the fact socket_last_error() could no longer be used to retrieve the last error on the socket as PHP streams don't save this information. There may be other issues I'm not aware of. > We don't have alternative to setting socket options on a stream. Neither > we want one - why have two functions for doing the same thing? Because the sockets extension is not enabled by default and it has a different design -- it provides a low-level interface that closely follows the C interface. Compelling functionality should still be added to the streams, hopefully with a friendlier interface than socket_set_option. -- Gustavo Lopes