"global" TCP_NODELAY?

Tom Judge tom at tomjudge.com
Mon Oct 12 13:50:26 UTC 2009


Ivan Voras wrote:
> Sergey Smitienko wrote:
>> Ivan Voras пишет:
>>> I'm trying to work around some extreme brain damageness in PHP (yes, 
>>> it sucks) which doesn't have a way to set TCP_NODELAY on stream 
>>> sockets so I'm wondering what are my other options? Is there a way 
>>> to set TCP_NODELAY system-wide?
>> What's wrong with:
>>
>> <?php
>> $socket = socket_create_listen(1223);
>> socket_set_option($socket, SOL_SOCKET, TCP_NODELAY, 1);
>> var_dump(socket_get_option($socket, SOL_SOCKET, TCP_NODELAY));
>> ?>
>
> These "socket objects" are completely different from fsockopen() 
> "stream socket objects", and socket_set_option() doesn't work on 
> those. Consequently, you cannot use fgets() and friends to work with 
> sockets created with socket_*() and there is apparently no way to wrap 
> sockets in streams. It's an already finished application that uses 
> stream-like functions (e.g. fgets() and friends) and rewriting it to 
> use raw socket recv() and send() would be nasty.
Is this for php java bridge by any chance?  If so I believe we have a 
patch floating around so that it can use UNIX sockets rather than INET ones.

TJ


More information about the freebsd-hackers mailing list