mirror of
https://github.com/php/doc-it.git
synced 2026-03-24 15:42:46 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314557 c90b9560-bf6c-de11-be94-00142212c4b1
84 lines
2.8 KiB
XML
84 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- splitted from ./it/functions/sockets.xml, last change in rev 1.4 -->
|
|
<!-- last change to 'socket-strerror' in en/ tree in rev 1.8 -->
|
|
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
|
|
<!-- OLD-Revision: 1.34/EN.1.8 -->
|
|
<refentry xml:id="function.socket-strerror" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>socket_strerror</refname>
|
|
<refpurpose>Restituisce una stringa con la descrizione dell'errore.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>socket_strerror</methodname>
|
|
<methodparam><type>int</type><parameter>errno</parameter></methodparam>
|
|
</methodsynopsis>
|
|
&warn.experimental.func;
|
|
<para>
|
|
La funzione <function>socket_strerror</function> utilizza come proprio
|
|
parametro <parameter>errno</parameter> il codice di errore di un socket fornito da
|
|
<function>socket_last_error</function> e restituisce il corrispondente testo
|
|
descrittivo. Questo rende più semplice piegare cosa è accaduto quando qualcosa
|
|
non funziona; ad esempio, invece di dovere cercare in tutto il
|
|
sistema un file che contenga la spiegazione di '-111', si può semplicemente
|
|
passare il valore a <function>socket_strerror</function>, e ottenere la
|
|
spiegazione di ciò che è accaduto.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Esempio di uso di <function>socket_strerror</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (false == ($socket = @socket_create (AF_INET, SOCK_STREAM, SOL_TCP))) {
|
|
echo "socket_create() fallito: motivo: " . socket_strerror (socket_last_error()) . "\n";
|
|
}
|
|
|
|
if (false == (@socket_bind ($socket, '127.0.0.1', 80))) {
|
|
echo "socket_bind() fallito: motivo: " . socket_strerror (socket_last_error($socket)) . "\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Dall'esempio precedente (se non viene eseguito con i
|
|
privilegi di root) ci si aspetta il seguente messaggio:
|
|
<screen>
|
|
socket_bind() fallito: motivo: Permission denied
|
|
</screen>
|
|
</para>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Vedere anche
|
|
<function>socket_accept</function>,
|
|
<function>socket_bind</function>,
|
|
<function>socket_connect</function>,
|
|
<function>socket_listen</function> e
|
|
<function>socket_create</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|