thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Chu <simonchu....@gmail.com>
Subject Re: generated php code, resource not valid
Date Fri, 18 Sep 2009 21:01:08 GMT
    $socket = new TSocket("thriftpuzzle.facebook.com", 9030);
    $transport = new TBufferedTransport($socket);
    $protocol  = new TBinaryProtocol($transport);

    //$ssclient = new SimonSaysClient("thriftpuzzle.facebook.com");
    $ssclient = new SimonSaysClient($protocol);
    $ssclient->registerClient("emailaddr@gmail.com");

PHP Warning:  stream_set_timeout(): supplied argument is not a valid stream
resource in
/home/simon/PROG/PHP/UTILITY/trunk/facebook/thrift/transport/TSocket.php on
line 281
PHP Warning:  stream_get_meta_data(): supplied argument is not a valid
stream resource in
/home/simon/PROG/PHP/UTILITY/trunk/facebook/thrift/transport/TSocket.php on
line 287
Failed registeringTSocket: Could not write 55 bytes
http://thriftpuzzle.facebook.com:9030

Am I supposed to set timeout parameters?, this->handle_ apparently is not
valid, something failed connecting to the server

Simon

On Fri, Sep 18, 2009 at 11:43 AM, bill fumerola <billf@mu.org> wrote:

> On Fri, Sep 18, 2009 at 11:07:10AM -0700, Simon Chu wrote:
> > i)  is the C, cpp interface similar, please give example
>
> c++ interface is as identical as a php and c++ implementation can be.
>
> shared_ptr<TSocket> socket (new TSocket(host, port));
> shared_ptr<TTransport> transport (new TBufferedTransport(socket);
> shared_ptr<TProtocol> protocol (new TBinaryProtocol(transport));
> shared_ptr<myClient> client (new myClient(protocol);
>
> try {
>  transport->open();
>  int ret = client->someCallReturnsInt();
> } catch (exception &e) {
>  cout << "exception: " << e.what() << endl;
> }
>
> > ii)  I got further.  Where is TException defined?  What is the method to
> > print out exception message?
>
> TException inherits from Exception.
>
>
> http://svn.apache.org/repos/asf/incubator/thrift/trunk/lib/php/src/Thrift.php
>
> http://us2.php.net/manual/en/language.exceptions.php
>
> e.g.
> try {
>  $transport->open();
> } catch (Exception $e) {
>  echo $e->getMessage();
> }
>
>
> -- bill
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message