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:
Exception msg Could not write 55 bytes http://thriftpuzzle.facebook.com:9030 Sorry if this is a repeat, not sure if my last post went through. Simon On Fri, Sep 18, 2009 at 11:43 AM, bill fumerola <[email protected]> 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 >
