#38311 [Opn->Csd]: About the note in socket-getpeername's documentation
| From: | kalle@php.net | Date: | Sat, 26 Dec 2009 18:31:46 +0000 |
| Subject: | #38311 [Opn->Csd]: About the note in socket-getpeername's documentation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3572@lists.php.net to get a copy of this message | ||
ID: 38311
Updated by: kalle@php.net
Reported By: axelluttgens at swing dot be
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: n/a
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
I added your note to the documentation
Previous Comments:
------------------------------------------------------------------------
[2009-12-26 18:31:40] svn@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=292666
Log: Fixed bug #38311 (About the note in socket-getpeername's
documentation)
------------------------------------------------------------------------
[2007-08-19 09:36:37] axelluttgens at swing dot be
Hello vrana.
OK, I now see what the note tries to convey, and may thus more easily
explain why it makes me incomfortable.
As it is currently formulated, I tend to understand it as being made of
two independant parts:
- a "prohibition" (error condition? crash?) in a very precise case,
- an enumeration of two "allowed" cases.
But this sure hasn't been the intent of the note's writer ;-)
I believe that the note tends to cover too much and to be too precise
in too few words.
Perhaps just keeping the overall idea might prove less confusing, with
something like this:
Note: for having socket_getpeername() return a meaningful value,
the socket it is applied upon must of course be one for which
the concept of "peer" makes sense.
Now, I understand that writing documentation is a very difficult
matter, and that one reader isn't the other... It may well be that
the "problem" is on my side.
Anyway, thanks for the follow up,
Axel
PS: should you choose to update the doc, a similar change could be done
for socket_getsockname() too.
------------------------------------------------------------------------
[2007-08-17 18:32:07] vrana@php.net
Can you please consult bug #21366?
------------------------------------------------------------------------
[2006-08-03 10:23:08] axelluttgens at swing dot be
Description:
------------
I really don't understand following sentence, appearing at
manual/en/function.socket-getpeername.php:
Note: socket_getpeername() should not be used with
AF_UNIX sockets created with socket_accept(). Only
sockets created with socket_connect() or a primary
server socket following a call to socket_bind() will
return meaningful values.
For example,
$connection = socket_accept($endpoint);
socket_getpeername($connection, $peer, $peerport);
works perfectly well (one gets client's address and port).
More generally, above excerpt tends to remove a good deal of the
generality of the getpeername(2) system call.
It seems that some kind of cut/paste errors occured while writing above
note. For example, perhaps should it have read:
Note: socket_getpeername() should not be used with
AF_UNIX sockets created with socket_create(). Only
sockets created with socket_connect() or a primary
server socket following a call to socket_accept() will
return meaningful values.
But even so, it would remain somewhat obscure.
HTH,
Axel
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38311&edit=1