mfischer Wed May 1 12:07:30 2002 EDT Modified files: /phpdoc/en/reference/sockets/functions socket-getsockname.xml Log: - Initial documentation. Index: phpdoc/en/reference/sockets/functions/socket-getsockname.xml diff -u phpdoc/en/reference/sockets/functions/socket-getsockname.xml:1.2 phpdoc/en/reference/sockets/functions/socket-getsockname.xml:1.3 --- phpdoc/en/reference/sockets/functions/socket-getsockname.xml:1.2 Wed Apr 17 02:44:08 2002 +++ phpdoc/en/reference/sockets/functions/socket-getsockname.xml Wed May 1 +12:07:30 2002 @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/sockets.xml, last change in rev 1.27 --> <refentry id="function.socket-getsockname"> <refnamediv> <refname>socket_getsockname</refname> - <refpurpose>Given an fd, stores a string representing sa.sin_addr and the value of sa.sin_port into addr and port describing the local side of a socket </refpurpose> + <refpurpose> + Queries the local side of the given socket which may either result in host/port + or in a UNIX filesystem path, dependent on its type. + </refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -16,7 +19,30 @@ </methodsynopsis> &warn.experimental.func; <para> - &warn.undocumented.func; + If the given socket is of type <constant>AF_INET</constant>, + <function>socket_getsockname</function> will return the local + <emphasis>IP address</emphasis> in dotted-quad notation (e.g. + <literal>127.0.0.1</literal>) in the <parameter>address</parameter> + parameter and, if the optional <parameter>port</parameter> parameter is + present, also the associated port. + </para> + <para> + If the given socket is of type <constant>AF_UNIX</constant>, + <function>socket_getsockname</function> will return the UNIX filesystem + path (e.g. <literal>/var/run/daemon.sock</literal>) in the + <parameter>address</parameter> parameter. + </para> + <para> + &return.success; <function>socket_getsockname</function> may also return + &false; if the socket type is not any of <constant>AF_INET</constant> or + <constant>AF_UNIX</constant>, in which case the last socket error code is + <emphasis>not</emphasis> updated. + </para> + <para> + See also + <function>socket_getpeername</function>, + <function>socket_last_error</function> and + <function>socket_strerror</function>. </para> </refsect1> </refentry>