mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-28 23:08:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@171118 c90b9560-bf6c-de11-be94-00142212c4b1
74 lines
2.2 KiB
XML
74 lines
2.2 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.5 $ -->
|
|
<!-- splitted from ./en/functions/network.xml, last change in rev 1.2 -->
|
|
<refentry id="function.getservbyname">
|
|
<refnamediv>
|
|
<refname>getservbyname</refname>
|
|
<refpurpose>
|
|
Get port number associated with an Internet service and protocol
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>getservbyname</methodname>
|
|
<methodparam><type>string</type><parameter>service</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>protocol</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>getservbyname</function> returns the Internet port
|
|
which corresponds to <parameter>service</parameter> for the
|
|
specified <parameter>protocol</parameter> as per
|
|
<filename>/etc/services</filename>.
|
|
<parameter>protocol</parameter> is either <literal>"tcp"</literal>
|
|
or <literal>"udp"</literal> (in lowercase). Returns &false; if
|
|
<parameter>service</parameter> or <parameter>protocol</parameter> is not
|
|
found.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>getservbyname</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$services = array('http', 'ftp', 'ssh', 'telnet', 'imap',
|
|
'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
|
|
|
|
foreach ($services as $service) {
|
|
$port = getservbyname($service, 'tcp');
|
|
echo $service . ": " . $port . "<br />\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
For complete list of port numbers see: &url.network.port-numbers;.
|
|
</para>
|
|
<para>
|
|
See also: <function>getservbyport</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:"../../../../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
|
|
-->
|