1

I am using thrift and I have a java client and server. I am calling some functions on the server from the client and that part is already working. After calling the functions, I have an output file created in the machine where the server is running. I need to return this file to the client. How can I accomplish this? Should I use TFileTransfer? If not, is there a better way to get the data back?

In a sense, I need to create a client within the server..

I am new to Thrift and any help will be appreciated.

userJS
  • 119
  • 1
  • 14
  • There is unclear form me, and probably to You: transport what Thrift use (Your suggestion of TFileTransfer), and object (struct) being transmitted. Transferring content? filepath? of file (I don't use java File specially) is like any other object. Tell us, what do You think by word "file" when is transmitted? – Jacek Cz Sep 08 '15 at 07:59
  • In many situations only content of file is important (name, path, creation date etc is in-important) But sometimes requirement has changing. Your file is Text or Binary? – Jacek Cz Sep 08 '15 at 08:01
  • possible duplicate of [Thrift large file in messages](http://stackoverflow.com/questions/23188775/thrift-large-file-in-messages) – JensG Sep 08 '15 at 09:12
  • Actually, it is more a duplicate of [this question](http://stackoverflow.com/questions/20960541/file-transport-between-server-client) because it answers the question much better. – JensG Sep 08 '15 at 09:13
  • @JacekCz I meant I would like to transfer the entire file. Similar functionality to Scp. – userJS Sep 08 '15 at 16:16
  • @JensG I saw the post you are referring to before. The reason I am unable to do it is because I would like to transfer from server to client (the server and client is already established and I am executing some commands on the server when the client needs it. The framework is set up) So in a sense, I need to create a server within the existing client and a client within the existing server. Does this seem possible? – userJS Sep 08 '15 at 16:19
  • The StreamFileService from my second link does exactly that: the client asks the server for file contents. If you want it the other way round, the client can also send any amount of bytes to the server side. So I don't see any issue. Maybe you want to add an example if it is still unclear? – JensG Sep 08 '15 at 18:53
  • Or maybe you want [server push](http://www.oreilly.com/openbook/cgi/figs/cgi0608.gif) messages? Is that what you really want? – JensG Sep 09 '15 at 08:22
  • Sorry for the delay. You are right. the second link does work. Thanks a lot – userJS Sep 09 '15 at 23:05

0 Answers0