php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #26486 socket_create Constats missing
Submitted: 2003-12-01 08:02 UTC Modified: 2003-12-15 14:38 UTC
From: nunoplopes at sapo dot pt Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
 [2003-12-01 08:02 UTC] nunoplopes at sapo dot pt
Description:
------------
In socket_create manual entry and in table 3 (common protocls) you only say the name of the protocols and you missed the constants.
Instead of tcp, you should write SOL_TCP.

In sockets' main page, you should alter the following line:
$socket = socket_create (AF_INET, SOCK_STREAM, 0);

to

$socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-02 10:08 UTC] nunoplopes at sapo dot pt
You may apply these patches:

Index: reference.xml
===================================================================
RCS file: /repository/phpdoc/en/reference/sockets/reference.xml,v
retrieving revision 1.11
diff -u -r1.11 reference.xml
--- reference.xml       16 Aug 2003 18:59:12 -0000      1.11
+++ reference.xml       2 Dec 2003 15:05:45 -0000
@@ -190,7 +190,7 @@
 $address = gethostbyname ('www.example.com');

 /* Create a TCP/IP socket. */
-$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+$socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);
 if ($socket < 0) {
     echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n";

 } else {


and:
Index: socket-create.xml
===================================================================
RCS file: /repository/phpdoc/en/reference/sockets/functions/socket-create.xml,v
retrieving revision 1.6
diff -u -r1.6 socket-create.xml
--- socket-create.xml   22 Jun 2003 19:43:21 -0000      1.6
+++ socket-create.xml   2 Dec 2003 15:10:03 -0000
@@ -142,7 +142,7 @@
        </entry>
       </row>
       <row>
-       <entry>udp</entry>
+       <entry>SOL_UDP</entry>
        <entry>
         The User Datagram Protocol is a connectionless, unreliable,
         protocol with fixed record lengths. Due to these aspects, UDP
@@ -150,7 +150,7 @@
        </entry>
       </row>
         <row>
-       <entry>tcp</entry>
+       <entry>SOL_TCP</entry>
        <entry>
         The Transmission Control Protocol is a reliable, connection based,
         stream oriented, full duplex protocol. TCP guarantees that all data packets


---------
I don't know the constant for icmp. maybe its SOL_SOCKET??
 [2003-12-15 14:38 UTC] dave@php.net
The SOL_TCP and SOL_UDP constants are listed in the paragraph above the table. The "names" in the table are strings you use with getprotobyname() (as the paragraph explains). I have, however, changed that 0 in the example to SOL_TCP for clarity. Thanks for pointing this out!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 22 17:00:01 2025 UTC