Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47266 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75199 invoked from network); 14 Mar 2010 14:29:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2010 14:29:52 -0000 Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:50769] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/60-07348-ED2FC9B4 for ; Sun, 14 Mar 2010 09:29:51 -0500 Received: by wyb36 with SMTP id 36so466260wyb.29 for ; Sun, 14 Mar 2010 07:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=VqoJEIMFUGFrsVgXjepClzdiSig0WHQWn+3MG9iYHzI=; b=WnMs/X4Ungxkz9q+02+VqaWCAw4R8NOwGEk8QYxQADM1djhNKgNR2tTw+kC+oBo4zP mwwVL+e1TLuAupcxuZYFhKHXgtcMfx2MhqKJCH9NaoCS33VKKOsPdYquVfIW1n3A/XSR ykjMkDKDGAzHlqrLoUnf1pjOIMgNDudGZdE18= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=UV1PMr++8Rbexpr7Irq2BugW4gwpxpSSr3xOl6NxxMYNkcq+ns3/iVf3oqyLUke+cu sS9/i5mRIY3CuRzjuUSMb7L3AQSB+loJcZUayIYPzNu6wUdmx7nOdAOpkDsOmQ4nxbdm hmV6xlPdX8tjq8rShj0FhzCd346Y34H47UbRc= Received: by 10.216.162.10 with SMTP id x10mr2468938wek.118.1268576987718; Sun, 14 Mar 2010 07:29:47 -0700 (PDT) Received: from [192.168.1.26] (69.Red-88-21-128.staticIP.rima-tde.net [88.21.128.69]) by mx.google.com with ESMTPS id i35sm10821703gve.11.2010.03.14.07.29.45 (version=SSLv3 cipher=RC4-MD5); Sun, 14 Mar 2010 07:29:46 -0700 (PDT) Message-ID: <4B9CF2F7.2080905@gmail.com> Date: Sun, 14 Mar 2010 15:30:15 +0100 User-Agent: Thunderbird MIME-Version: 1.0 To: Dennis Hotson CC: PHP Developers Mailing List References: <469956791003132238p4bc841a0sd0c8a09e3ee1b084@mail.gmail.com> In-Reply-To: <469956791003132238p4bc841a0sd0c8a09e3ee1b084@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implementing fdopen in PHP From: keisial@gmail.com (Keisial) Dennis Hotson wrote: > Hi all, > > It's my first post, so go easy on me. :-) > > I'm trying to implement PHP support for github's erlang RPC server called > ernie. > So basically I've been porting the following ruby code to PHP: > http://github.com/mojombo/ernie/blob/master/lib/ernie.rb > > The problem I'm having is on line 127-128: > input = IO.new(3) > > I believe this is equivalent to fdopen() in C, but there doesn't appear to > be any way to do this in PHP. > > So basically, I'm a bit stuck and looking for advice on how to proceed. > Should I implement this in core PHP or as an extension? What's the best way > to get a function like this into PHP? > > Regards, > Dennis Hotson > You perform a fdopen() in C where you have a low level file descriptor and make it a stdio on. In php there's only one kind of file descriptor, and all file functions work with them. Creating a fdopen call is useless, since it needs a previous descriptor to work from, and all descriptors are equal. Where's that file descriptor coming from? Since it's an RPC server I suspect you will create it somehow with fsockopen.