1

I want to develop a Qt5/C++ client-server application using remote procedure calls (RPC).

Idea: The server listens for incoming connections of multiple clients. Clients offer a set of procedures/services the server can call in order to collect data from clients and inform other clients about changes.

And here is the catch: The RPC libs i've seen so far seem to expect the server to offer a service the clients may call. But I want to do the opposite. Clients should offer services the server may call. The direction is important, because I want to enable port forwarding on the server side only, not on the client side.

The libs I've checked are:

Questions:

  • Is there a reason these libs offer services on server side only?
  • Did I maybe only miss that part in the documentation?
  • Is there an RPC lib that does offer client side service offering?
Simpl
  • 1,938
  • 1
  • 10
  • 21
  • 1
    Please confirm: It sounds like you want A connects to B and offers services to B. – user4581301 Jan 10 '17 at 21:52
  • Yes, thats how it's supposed to work. – Simpl Jan 10 '17 at 21:56
  • Don't know of any off hand. Have you considered A opens tunnel to B, B connects to and requests services from A through the tunnel? – user4581301 Jan 10 '17 at 22:01
  • 1
    You have asked 3 questions about libraries you look in and we can mostly answer in terms of tags: C++ / Qt / RPC. That makes us study those 3rd party libraries? I can probably offer you something how to work around such demand but the 3 questions aren't about that. – Alexander V Jan 10 '17 at 23:01
  • I don't expect anyone to study libraries for me :) Maybe someone has already had experience with a lib and found a way to offer services on client side. I would really like to know your workarounds for my problem. – Simpl Jan 11 '17 at 10:22
  • If found this answer to related question: http://stackoverflow.com/a/30009838/7401546 "No, a server cannot invoke calls on the client. gRPC works with HTTP, and HTTP has not had such semantics in the past." – Simpl Jan 11 '17 at 10:31
  • Look at Qt Websockets: server requests client via websocket and the client replies via HTTP/REST. I can explain in more details and refer to docs but unsure whether you want it or not. – Alexander V Jan 11 '17 at 17:41

1 Answers1

2

gRPC supports bidirectional streaming, which may meet your needs.

Clients can open a long lived connection to a server, and then the server can "call" the clients by sending responses on the stream.

The client can respond by sending another message on the stream.

http://www.grpc.io/docs/tutorials/basic/c.html

kpayson64
  • 353
  • 1
  • 4