From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 12 12:09:37 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A54341065670 for ; Mon, 12 Oct 2009 12:09:37 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 62C498FC08 for ; Mon, 12 Oct 2009 12:09:37 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.50) id 1MxJfR-0003u3-18 for freebsd-hackers@freebsd.org; Mon, 12 Oct 2009 14:06:21 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Oct 2009 14:06:21 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Oct 2009 14:06:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Ivan Voras Date: Mon, 12 Oct 2009 14:02:51 +0200 Lines: 21 Message-ID: References: <4AD31431.4060503@comsys.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.23 (X11/20090928) In-Reply-To: <4AD31431.4060503@comsys.com.ua> Sender: news Subject: Re: "global" TCP_NODELAY? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 12:09:37 -0000 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: > > $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.