ID: 38311
User updated by: axelluttgens at swing dot be
Reported By: axelluttgens at swing dot be
-Status: Feedback
+Status: Open
Bug Type: Documentation problem
Operating System: n/a
PHP Version: Irrelevant
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-08-17 18:32:07] [EMAIL PROTECTED]
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