Hi Wilm,

Apparently you're using the default and buggy BufferedTransport...
Have you try using TFramedTransport?
you can have a look on the tests for an example:
https://github.com/apache/thrift/tree/master/test/nodejs

Best,
Henrique


On 7 August 2013 13:43, Wilm Schumacher <[email protected]> wrote:

> Hi,
>
> I'm new to thrift, and I have a little trouble getting everything running.
>
> At first the requirement: I want to get a c++-thrift-server running and
> call it by a node.js client.
>
> For that purpose I designed this "service":
>
> ## test.thrift ##
> namespace cpp test
>
> struct Message2Server {
>         1: string message
> }
>
> struct Message2Client {
>         1: string message
> }
>
> service test {
>   Message2Client ping( 1:Message2Server message )
> }
> ##################
>
> where I uses the two structs "Message2..." to simulate different more
> complicated in- and outputs, but here it actually only swaps strings for
> the purpose of testing.
>
> The client.cpp, server.cpp, client.js and server.js are found here (with
> the thrift file is included and where thrift is already run)
> https://lserv.uni-jena.de/upload-data/5202322b44bd7/test.zip
>
> I only swap a Message2Server and a Message2Client. With a "ping"-"pong"
>
> When I run the cpp-server and call it by the cpp-client everything is
> fine. I get my "ping"-"pong".
>
> But: when I run the node-server and call it with the node-client I get
> my "ping". However ... the "pong" won't arrive. I get a "ping failed:
> unknown result". Obviously the object I send is wrong. But what do I wrong?
>
> If I run the node-server and call it with the cpp-client I get an error
> from the server,
> "read(4) failed - not enough data"
> and from the client
> "ERROR: No more data to read."
>
> If I run the cpp-server and call it with the node-client I get an error
> from the server nothing happens. It seems that both sides wait for
> input. And if I kill the client, I get the error from the server
> "Thrift: Wed Aug  7 13:28:37 2013 TSimpleServer client died: No more
> data to read." (of course)
>
> Obviously I do something wrong. And I think it is on the "node"-side of
> the code. Unfortunately the official documentation for "thrift-node" is
> not too extensive and I didn't found any help, thus I wrote this message.
>
> If my question is already answered, or if I should read some
> documentation, I would be very happy for any hints.
>
> Thanks for reading and best wishes
>
> Wilm
>

Reply via email to