Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Oct 2009 14:02:51 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: "global" TCP_NODELAY?
Message-ID:  <hav5t5$u1t$1@ger.gmane.org>
In-Reply-To: <4AD31431.4060503@comsys.com.ua>
References:  <hav3qp$n7n$1@ger.gmane.org> <4AD31431.4060503@comsys.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?hav5t5$u1t$1>