2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2002-04-30 22:53:24 +00:00
|
|
|
<!-- $Revision: 1.3 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/sockets.xml, last change in rev 1.4 -->
|
|
|
|
<refentry id="function.socket-create">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>socket_create</refname>
|
|
|
|
<refpurpose>Create a socket (endpoint for communication)</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>resource</type><methodname>socket_create</methodname>
|
|
|
|
<methodparam><type>int</type><parameter>domain</parameter></methodparam>
|
|
|
|
<methodparam><type>int</type><parameter>type</parameter></methodparam>
|
|
|
|
<methodparam><type>int</type><parameter>protocol</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
&warn.experimental.func;
|
|
|
|
<para>
|
2002-04-30 22:53:24 +00:00
|
|
|
Creates a communication endpoint (a socket), and returns a socket
|
|
|
|
resource.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-04-30 22:53:24 +00:00
|
|
|
The <parameter>domain</parameter> parameter sets the domain (protocol
|
|
|
|
family) to be used for communication. Currently,
|
|
|
|
<constant>AF_INET</constant> and <constant>AF_UNIX</constant> are
|
|
|
|
understood. <constant>AF_INET</constant> is typical used for internet
|
|
|
|
based communication. <constant>AF_UNIX</constant> uses pathnames to
|
|
|
|
identify sockets and can therefore only be used for local communication
|
|
|
|
(which is faster, on the other hand).
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The <parameter>type</parameter> parameter selects the socket
|
|
|
|
type. This is one of <constant>SOCK_STREAM</constant>,
|
|
|
|
<constant>SOCK_DGRAM</constant>,
|
|
|
|
<constant>SOCK_SEQPACKET</constant>,
|
|
|
|
<constant>SOCK_RAW</constant>, <constant>SOCK_RDM</constant>, or
|
2002-04-30 22:53:24 +00:00
|
|
|
<constant>SOCK_PACKET</constant>. The two most common types are
|
|
|
|
<constant>SOCK_DGRAM</constant> for <literal>UDP</literal>
|
|
|
|
(connectionless) communication
|
|
|
|
and <constant>SOCK_STREAM</constant> for <literal>TCP</literal>
|
|
|
|
communication.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-04-30 22:53:24 +00:00
|
|
|
<parameter>protocol</parameter> sets the protocol which is either
|
|
|
|
<constant>SOL_UDP</constant> or <constant>SOL_TCP</constant>.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-04-30 22:53:24 +00:00
|
|
|
Returns a socket resource on success, or &false; on error. The actual
|
|
|
|
error code can be retrieved by calling
|
|
|
|
<function>socket_last_error</function>. This error code may be passed to
|
2002-04-15 00:12:54 +00:00
|
|
|
<function>socket_strerror</function> to get a textual explanation of the
|
|
|
|
error.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
For more information on the usage of <function>socket_create</function>,
|
|
|
|
as well as on the meanings of the various parameters, see the
|
|
|
|
Unix man page socket (2).
|
|
|
|
</para>
|
2002-04-30 22:53:24 +00:00
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
If an invalid <parameter>domain</parameter> or
|
|
|
|
<parameter>type</parameter> is given, <function>socket_create</function>
|
|
|
|
defaults to <constant>AF_INET</constant> and
|
|
|
|
<constant>SOCK_STREAM</constant> respectively and additionally emits an
|
|
|
|
<constant>E_WARNING</constant> message.
|
|
|
|
</para>
|
|
|
|
</note>
|
2002-04-15 00:12:54 +00:00
|
|
|
<para>
|
|
|
|
See also
|
|
|
|
<function>socket_accept</function>,
|
|
|
|
<function>socket_bind</function>,
|
|
|
|
<function>socket_connect</function>,
|
2002-04-30 22:53:24 +00:00
|
|
|
<function>socket_listen</function>,
|
|
|
|
<function>socket_last_error</function>, and
|
2002-04-15 00:12:54 +00:00
|
|
|
<function>socket_strerror</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
|
|
|
|
-->
|