[PHP-DOC] cvs: phpdoc-it /reference/sockets/functions socket-last-error.xml From: Andrioli Darvin (darvin.andrioli <email protected>)
Date: 06/02/02

darvina Sun Jun 2 08:45:49 2002 EDT

  Modified files:
    /phpdoc-it/reference/sockets/functions socket-last-error.xml
  Log:
  Update to En 1.4
  
Index: phpdoc-it/reference/sockets/functions/socket-last-error.xml
diff -u phpdoc-it/reference/sockets/functions/socket-last-error.xml:1.2 phpdoc-it/reference/sockets/functions/socket-last-error.xml:1.3
--- phpdoc-it/reference/sockets/functions/socket-last-error.xml:1.2 Wed Apr 17 03:08:40 2002
+++ phpdoc-it/reference/sockets/functions/socket-last-error.xml Sun Jun 2 08:45:49 2002
@@ -1,23 +1,48 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!-- splitted from ./it/functions/sockets.xml, last change in rev 1.1 -->
 <!-- last change to 'socket-last-error' in en/ tree in rev 1.1 -->
-<!-- EN-Revision: 1.2 Maintainer: darvina Status: ready -->
+<!-- EN-Revision: 1.4 Maintainer: darvina Status: ready -->
 <!-- OLD-Revision: 1.34/EN.1.1 -->
   <refentry id="function.socket-last-error">
    <refnamediv>
     <refname>socket_last_error</refname>
- <refpurpose>Restituisce/pulisce l'ultimo errore su un socket. </refpurpose>
+ <refpurpose>Restituisce l'ultimo errore su un socket. </refpurpose>
    </refnamediv>
    <refsect1>
     <title>Descrizione</title>
      <methodsynopsis>
       <type>int</type><methodname>socket_last_error</methodname>
- <methodparam><type>resource</type><parameter>socket</parameter></methodparam>
+ <methodparam choice="opt"><type>resource</type><parameter>socket</parameter></methodparam>
      </methodsynopsis>
      &warn.experimental.func;
     <para>
- &warn.undocumented.func;
+ Questa funzione restituisce il codice di errore di un socket.
     </para>
+ <para>
+ Se a questa funzione si passa una risorsa di tipo socket, essa restituisce
+ l'ultimo errore occorso in quel socket. Se, al contrario, si omette di indicare il
+ socket, verrā restituito l'ultimo errore generato dalle funzioni dei socket.
+ Il secondo caso č particolarmente utile per funzioni tipo
+ <function>socket_create</function>, che in caso di errore non restituiscono un
+ socket, o <function>socket_select</function>, che possono fallire per ragioni
+ non direttamente collegate ad un particolare socket. Il codice di errore č
+ utilizzabile dalla funzione <function>socket_strerror</function> per ottenere un testo
+ con la spiegazione del codice di errore dato.
+ <programlisting role="php">
+<![CDATA[
+if (false == ($socket =  <email protected>(AF_INET, SOCK_STREAM, SOL_TCP))) {
+ die("Non si riesce a creare il socket, codice di errore: " . socket_last_error() .
+ ",descrizione: " . socket_strerror(socket_last_error()));
+}
+]]>
+ </programlisting>
+ </para>
+ <note>
+ <para>
+ <function>socket_last_error</function> non rimuove il codice di errore, utilizzare
+ <function>socket_clear_error</function> per questo scopo.
+ </para>
+ </note>
    </refsect1>
   </refentry>