Professional Web Applications Themes

#46360 [NEW]: [patch] Add TCP_NODELAY constant for socket_{get,set}_option - PHP Bugs

From: bugs at trick dot vanstaveren dot us Operating system: All PHP version: 5.2.6 PHP Bug Type: Sockets related Bug description: [patch] Add TCP_NODELAY constant for socket_{get,set}_option Description: ------------ C-level TCP function setsockopt allows users of TCP sockets to set the TCP_NODELAY flag. This flag disable's the typically default use of Nagle's Algorithm[1] on a TCP socket. 1: http://en.wikipedia.org/wiki/Nagle%27s_algorithm Nagle's Algorithm is bad for protocols like the extremely brief one spoken by PHP/Java Bridge. This patch is inspired by my use of PJB on FreeBSD which does not automatically set TCP_NODELAY on localhost connections. PHP does not expose this constant, ...

  1. #1

    Default #46360 [NEW]: [patch] Add TCP_NODELAY constant for socket_{get,set}_option

    From: bugs at trick dot vanstaveren dot us
    Operating system: All
    PHP version: 5.2.6
    PHP Bug Type: Sockets related
    Bug description: [patch] Add TCP_NODELAY constant for socket_{get,set}_option

    Description:
    ------------
    C-level TCP function setsockopt allows users of TCP sockets to set the
    TCP_NODELAY flag. This flag disable's the typically default use of Nagle's
    Algorithm[1] on a TCP socket.

    1: http://en.wikipedia.org/wiki/Nagle%27s_algorithm

    Nagle's Algorithm is bad for protocols like the extremely brief one spoken
    by PHP/Java Bridge. This patch is inspired by my use of PJB on FreeBSD
    which does not automatically set TCP_NODELAY on localhost connections.

    PHP does not expose this constant, although it is valid for the sockets
    library as socket_set_option is a straightforward wrapper around
    setsockopt.

    Here is a trivial patch against PHP 5.2.5 to add the PHP constant
    TCP_NODELAY. I have tested this on FreeBSD 7.0 + PHP 5.2.5. Patch is
    quite simple so should apply fine against 5.3 / 6 with just a line offset.
    Constant is the same on Linux so will work fine there; am not sure about
    win32. Happy to test other versions and platforms if necessary.

    --- ext/sockets/sockets.c.orig 2008-10-21 22:53:07.000000000 +0000
    +++ ext/sockets/sockets.c 2008-10-21 22:53:00.000000000 +0000
    -509,6 +509,7
    REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS |
    CONST_PERSISTENT);
    + REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS |
    CONST_PERSISTENT);

    Cheers,
    Patrick van Staveren


    --
    Edit bug report at http://bugs.php.net/?id=46360&edit=1
    --
    Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46360&r=trysnapshot52
    Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46360&r=trysnapshot53
    Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46360&r=trysnapshot60
    Fixed in CVS: http://bugs.php.net/fix.php?id=46360&r=fixedcvs
    Fixed in release: http://bugs.php.net/fix.php?id=46360&r=alreadyfixed
    Need backtrace: http://bugs.php.net/fix.php?id=46360&r=needtrace
    Need Reproduce Script: http://bugs.php.net/fix.php?id=46360&r=needscript
    Try newer version: http://bugs.php.net/fix.php?id=46360&r=oldversion
    Not developer issue: http://bugs.php.net/fix.php?id=46360&r=support
    Expected behavior: http://bugs.php.net/fix.php?id=46360&r=notwrong
    Not enough info: http://bugs.php.net/fix.php?id=46360&r=notenoughinfo
    Submitted twice: http://bugs.php.net/fix.php?id=46360&r=submittedtwice
    register_globals: http://bugs.php.net/fix.php?id=46360&r=globals
    PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46360&r=php4
    Daylight Savings: http://bugs.php.net/fix.php?id=46360&r=dst
    IIS Stability: http://bugs.php.net/fix.php?id=46360&r=isapi
    Install GNU Sed: http://bugs.php.net/fix.php?id=46360&r=gnused
    Floating point limitations: http://bugs.php.net/fix.php?id=46360&r=float
    No Zend Extensions: http://bugs.php.net/fix.php?id=46360&r=nozend
    MySQL Configuration Error: http://bugs.php.net/fix.php?id=46360&r=mysqlcfg

    bugs Guest

  2. #2

    Default #46360 [Opn]: [patch] Add TCP_NODELAY constant for socket_{get,set}_option

    ID: 46360
    Updated by: net
    Reported By: bugs at trick dot vanstaveren dot us
    Status: Open
    Bug Type: Sockets related
    Operating System: *
    PHP Version: 5.2.6
    New Comment:

    It exists on Windows, according to
    http://msdn.microsoft.com/en-us/library/ms740476(VS.85).aspx


    Previous Comments:
    ------------------------------------------------------------------------

    [2008-10-22 04:44:11] bugs at trick dot vanstaveren dot us

    Description:
    ------------
    C-level TCP function setsockopt allows users of TCP sockets to set the
    TCP_NODELAY flag. This flag disable's the typically default use of
    Nagle's Algorithm[1] on a TCP socket.

    1: http://en.wikipedia.org/wiki/Nagle%27s_algorithm

    Nagle's Algorithm is bad for protocols like the extremely brief one
    spoken by PHP/Java Bridge. This patch is inspired by my use of PJB on
    FreeBSD which does not automatically set TCP_NODELAY on localhost
    connections.

    PHP does not expose this constant, although it is valid for the sockets
    library as socket_set_option is a straightforward wrapper around
    setsockopt.

    Here is a trivial patch against PHP 5.2.5 to add the PHP constant
    TCP_NODELAY. I have tested this on FreeBSD 7.0 + PHP 5.2.5. Patch is
    quite simple so should apply fine against 5.3 / 6 with just a line
    offset. Constant is the same on Linux so will work fine there; am not
    sure about win32. Happy to test other versions and platforms if
    necessary.

    --- ext/sockets/sockets.c.orig 2008-10-21 22:53:07.000000000 +0000
    +++ ext/sockets/sockets.c 2008-10-21 22:53:00.000000000 +0000
    -509,6 +509,7
    REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS |
    CONST_PERSISTENT);
    + REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS |
    CONST_PERSISTENT);

    Cheers,
    Patrick van Staveren



    ------------------------------------------------------------------------


    --
    Edit this bug report at http://bugs.php.net/?id=46360&edit=1

    felipe@php.net Guest

  3. #3

    Default #46360 [Opn->Csd]: [PATCH] TCP_NODELAY constant for socket_{get,set}_option

    ID: 46360
    Updated by: net
    Reported By: bugs at trick dot vanstaveren dot us
    -Status: Open
    +Status: Closed
    Bug Type: Sockets related
    Operating System: *
    PHP Version: 5.2.6
    New Comment:

    This bug has been fixed in CVS.

    Snapshots of the sources are packaged every three hours; this change
    will be in the next snapshot. You can grab the snapshot at
    http://snaps.php.net/.

    Thank you for the report, and for helping us make PHP better.




    Previous Comments:
    ------------------------------------------------------------------------

    [2008-10-22 11:14:26] net

    It exists on Windows, according to
    http://msdn.microsoft.com/en-us/library/ms740476(VS.85).aspx

    ------------------------------------------------------------------------

    [2008-10-22 04:44:11] bugs at trick dot vanstaveren dot us

    Description:
    ------------
    C-level TCP function setsockopt allows users of TCP sockets to set the
    TCP_NODELAY flag. This flag disable's the typically default use of
    Nagle's Algorithm[1] on a TCP socket.

    1: http://en.wikipedia.org/wiki/Nagle%27s_algorithm

    Nagle's Algorithm is bad for protocols like the extremely brief one
    spoken by PHP/Java Bridge. This patch is inspired by my use of PJB on
    FreeBSD which does not automatically set TCP_NODELAY on localhost
    connections.

    PHP does not expose this constant, although it is valid for the sockets
    library as socket_set_option is a straightforward wrapper around
    setsockopt.

    Here is a trivial patch against PHP 5.2.5 to add the PHP constant
    TCP_NODELAY. I have tested this on FreeBSD 7.0 + PHP 5.2.5. Patch is
    quite simple so should apply fine against 5.3 / 6 with just a line
    offset. Constant is the same on Linux so will work fine there; am not
    sure about win32. Happy to test other versions and platforms if
    necessary.

    --- ext/sockets/sockets.c.orig 2008-10-21 22:53:07.000000000 +0000
    +++ ext/sockets/sockets.c 2008-10-21 22:53:00.000000000 +0000
    -509,6 +509,7
    REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS |
    CONST_PERSISTENT);
    + REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS |
    CONST_PERSISTENT);
    REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS |
    CONST_PERSISTENT);

    Cheers,
    Patrick van Staveren



    ------------------------------------------------------------------------


    --
    Edit this bug report at http://bugs.php.net/?id=46360&edit=1

    lbarnaud@php.net Guest

Similar Threads

  1. unexpected constant #2 65
    By CurtTheItGuy in forum Coldfusion Server Administration
    Replies: 5
    Last Post: July 29th, 10:17 AM
  2. Constant crashes with CS3 on OS 10.4.11
    By nco_editor in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: June 19th, 12:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139