Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57663 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88753 invoked from network); 3 Feb 2012 17:53:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2012 17:53:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=alok@fb.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alok@fb.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain fb.com designates 67.231.145.42 as permitted sender) X-PHP-List-Original-Sender: alok@fb.com X-Host-Fingerprint: 67.231.145.42 mx0a-00082601.pphosted.com Linux 2.5 (sometimes 2.4) (4) Received: from [67.231.145.42] ([67.231.145.42:34438] helo=mx0a-00082601.pphosted.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/00-20088-FFE1C2F4 for ; Fri, 03 Feb 2012 12:53:06 -0500 Received: from pps.filterd (m0004346 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.4/8.14.4) with SMTP id q13HmIYp004327 for ; Fri, 3 Feb 2012 09:53:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=JQIfOrJQ8y11aU3GFHN734GbZO0PRakvKhLSuwQ5eSQ=; b=UPTrHFTf8pp2LCkiQLxDNFEOVbtwhhffdreAoDJFj0gnmo19DrG9zbI9QTlwHY1ZwL6d rGzD60FB834V1lKiXztLUTIb+JixVNVsWIDODC78aW6WVYwaW/gZttrLpef+4Ezr21Y9 g+J3ETmANhrYVIQUw9UTwYTxnWRN9D/chAc= Received: from mail.thefacebook.com (corpout1.snc1.tfbnw.net [66.220.144.38]) by mx0a-00082601.pphosted.com with ESMTP id 12rkreg22u-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 03 Feb 2012 09:53:00 -0800 Received: from SC-MBX02-5.TheFacebook.com ([fe80::9dc2:cfe6:2745:44cc]) by sc-hub04.TheFacebook.com ([192.168.18.212]) with mapi id 14.01.0355.002; Fri, 3 Feb 2012 09:52:55 -0800 To: "internals@lists.php.net" Thread-Topic: stream_socket_server() and timeout Thread-Index: AQHM4pynCnjX57AQt0K3vDMxXliUpw== Date: Fri, 3 Feb 2012 17:52:54 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.12.0.110505 x-originating-ip: [192.168.18.252] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.6.7361,1.0.260,0.0.0000 definitions=2012-02-03_05:2012-02-02,2012-02-03,1970-01-01 signatures=0 X-Proofpoint-Spam-Reason: safe Subject: stream_socket_server() and timeout From: alok@fb.com (Alok Menghrajani) Hi, PHP fails to set the socket_last_error when stream_socket_server() times out. It is therefore impossible to tell if a timeout occurred or if the call failed for some other reason. Here is a simple piece of that should help understand this issue: '); $client =3D stream_socket_accept($sock, 1); $err =3D socket_last_error(); echo 'after: ', socket_strerror($err), "\t", $err, "\n"; PHP currently outputs: before: Protocol not supported 43 after: Protocol not supported 43 I have a patch to fix this issue: http://pastebin.com/6JLjZkNu The output then becomes: before: Protocol not supported 43 after: Operation timed out 60 However the patch adds #include "ext/sockets/php_sockets.h" to ext/standard/streamsfuncs.c. Is that something we are okay living with? Thanks, Alok