Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17572 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55485 invoked by uid 1010); 7 Aug 2005 16:19:22 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55469 invoked from network); 7 Aug 2005 16:19:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Aug 2005 16:19:22 -0000 X-Host-Fingerprint: 212.238.144.71 korving.demon.nl Received: from ([212.238.144.71:22021] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 48/CC-04646-98436F24 for ; Sun, 07 Aug 2005 12:19:21 -0400 Message-ID: <48.CC.04646.98436F24@pb1.pair.com> To: internals@lists.php.net Date: Sun, 7 Aug 2005 18:18:26 +0200 Lines: 22 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 212.238.144.71 Subject: non-standard behavior of socket_recvfrom() From: r.korving@xit.nl ("Ron Korving") Hi, This may be an odd suggestion/request, and nothing in the line of what's currently hot around here (PHP 5.1 that is), but I'm making it anyway: The current behavior of socket_recvfrom() (/etc/sockets/socket.h) on a connection error, is that it frees the buffer (recv_buf), throws an error and returns from the function. I'd like to suggest that more correct behaviour would be to use the buffer before returning. As far as I know, even on failure, the buffer can be used to extract information on why the connection was refused. I came upon this while I was trying to implement a traceroute algorithm, which should be pretty simple, but seems impossible because of this socket behavior in PHP. The change in the code of socket_recvfrom() would be very minimal. I would suggest a patch myself, but the problems are that I don't know how and I don't know nearly enough about the PHP engine to write solid code for it (maybe I should work on that). Ron