mirror of
https://github.com/php/doc-zh.git
synced 2026-03-24 07:02:15 +01:00
47 lines
1.9 KiB
XML
47 lines
1.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: f453f7036c74f5f8ce5e15d3d5abbaf8dfd599e2 Maintainer: Carbyn Wu Status: ready -->
|
|
<chapter xml:id="sockets.errors" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<title>Socket Errors</title>
|
|
<para>
|
|
Socket 扩展编写的目的是为功能强大的 BSD Socket 提供可用的接口。它能确保这些函数在 Win32 和 Unix
|
|
平台上都能很好的工作。在特定条件下,大部分 socket 函数如果发生错误都会发出一个 <constant>E_WARNING</constant>
|
|
消息描述错误内容。有时可能并不会如开发者所愿。例如,因为连接突然中断,<function>socket_read</function>
|
|
函数可能会突然发出一个 <constant>E_WARNING</constant> 消息。通常会使用 <literal>@</literal>
|
|
操作符来压制异常,然后在程序中用 <function>socket_last_error</function> 来捕获错误代码。可以调用
|
|
<function>socket_strerror</function> 函数通过错误代码获取错误描述。查看函数描述获取更多信息。
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Socket 扩展发出的 <constant>E_WARNING</constant>
|
|
信息都是英文的,但获取到的错误描述会根据当前区域(<constant>LC_MESSAGES</constant>)展示:
|
|
<screen>
|
|
<![CDATA[
|
|
Warning - socket_bind() unable to bind address [98]: Die Adresse wird bereits verwendet
|
|
]]>
|
|
</screen>
|
|
</para>
|
|
</note>
|
|
</chapter>
|
|
|
|
<!-- 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
|
|
-->
|