This is my entire program: (transport is not null, and no exception thrown
there...)
it threw exception at the last line:
$socket = new TSocket("thriftpuzzle.facebook.com", 9030);
if (($transport = new TBufferedTransport($socket)) == null) {
printf("Transport is null");
}
$protocol = new TBinaryProtocol($transport);
//$ssclient = new SimonSaysClient("thriftpuzzle.facebook.com");
$ssclient = new SimonSaysClient($protocol);
$ssclient->registerClient("[email protected]"); // replace emailaddr
with your email addr
Output:
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
thriftpuzzle.facebook.com:9030
On Fri, Sep 18, 2009 at 3:03 PM, Samir Mulder <[email protected]>wrote:
> Are you sure you successfully opened the transport?
>
> If possible, can you post the sample client prog you have so far?
>
> Samir
>
>
> On Sep 18, 2009, at 2:54 PM, Simon Chu wrote:
>
> 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
>>>
>>>
>