You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jan Dolecek (JIRA)" <ji...@apache.org> on 2010/05/10 21:50:30 UTC

[jira] Created: (THRIFT-778) PHP socket listening server

PHP socket listening server
---------------------------

                 Key: THRIFT-778
                 URL: https://issues.apache.org/jira/browse/THRIFT-778
             Project: Thrift
          Issue Type: New Feature
          Components: Library (PHP)
            Reporter: Jan Dolecek
            Priority: Minor


I just downloaded Thrift and I need to create servers in PHP, which will
listen on unix or tcp sockets. So I've implemented it and attaching the
patch.
I hope it could be helpful and/or useful for someone else too.

Here is example:
$socket = new TServerSocket("unix://$unixPath", -1);
$socket->listen();
while(true) $socket->select($processor);

Link: http://helemik.cz/juzna/opensource/php/thrift/php-server.patch
Samples: http://helemik.cz/juzna/opensource/php/thrift/server-sample.zip

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-778) PHP socket listening server

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-778.
--------------------------------

         Assignee: Nick Jones
    Fix Version/s: 0.4
       Resolution: Fixed

I attached Nick's patch as a starting point, since his was clearly marked as licensed to Apache. We can iterate from there as needed.

Thanks for the patch, Nick!

> PHP socket listening server
> ---------------------------
>
>                 Key: THRIFT-778
>                 URL: https://issues.apache.org/jira/browse/THRIFT-778
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Library (PHP)
>            Reporter: Jan Dolecek
>            Assignee: Nick Jones
>            Priority: Minor
>             Fix For: 0.4
>
>         Attachments: add-server-support.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I just downloaded Thrift and I need to create servers in PHP, which will
> listen on unix or tcp sockets. So I've implemented it and attaching the
> patch.
> I hope it could be helpful and/or useful for someone else too.
> Here is example:
> $socket = new TServerSocket("unix://$unixPath", -1);
> $socket->listen();
> while(true) $socket->select($processor);
> Link: http://helemik.cz/juzna/opensource/php/thrift/php-server.patch
> Samples: http://helemik.cz/juzna/opensource/php/thrift/server-sample.zip

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-778) PHP socket listening server

Posted by "Nick Jones (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Jones updated THRIFT-778:
------------------------------

    Attachment: add-server-support.patch

I'm attaching a patch which adds TServerTransport/TServerSocket, along with a generic TServer and TSimpleServer implementation. This is mostly based on the C# and Java implementations.

Example usage:

{code}
$processor = new TestProcessor(new XXXHandler());
$transport = new TServerSocket();
$transportFactory = new TTransportFactory();
$protocolFactory = new TBinaryProtocolFactory();
$server = new TSimpleServer($processor, $transport, $transportFactory, $transportFactory, $protocolFactory, $protocolFactory);
$server->serve();
{code}

Obviously the PHP library can't implement a TThreadedServer, so the next best alternative is to use a select call on a pool of sockets, like in the original patch in this ticket. I may look into implementing that in a slightly nicer fashion in the near future.

> PHP socket listening server
> ---------------------------
>
>                 Key: THRIFT-778
>                 URL: https://issues.apache.org/jira/browse/THRIFT-778
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Library (PHP)
>            Reporter: Jan Dolecek
>            Priority: Minor
>         Attachments: add-server-support.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I just downloaded Thrift and I need to create servers in PHP, which will
> listen on unix or tcp sockets. So I've implemented it and attaching the
> patch.
> I hope it could be helpful and/or useful for someone else too.
> Here is example:
> $socket = new TServerSocket("unix://$unixPath", -1);
> $socket->listen();
> while(true) $socket->select($processor);
> Link: http://helemik.cz/juzna/opensource/php/thrift/php-server.patch
> Samples: http://helemik.cz/juzna/opensource/php/thrift/server-sample.zip

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.