erpc icon indicating copy to clipboard operation
erpc copied to clipboard

Context for client API?

Open infn-ke opened this issue 4 years ago • 7 comments

How can a client use two different transport channels? Looks like there is no context in the generated code, instead the global variable g_client is used to retrieve the transport object.

infn-ke avatar Nov 27 '20 13:11 infn-ke

Hi eRPC user. Thank you for your interest and welcomme. We hope you will enjoy this framework well.

github-actions[bot] avatar Nov 27 '20 13:11 github-actions[bot]

Hello @infn-ke , yes, correct, it is not possible to use two different transports, this use case is not supported. @Hadatko , is there any way how to achieve this? I am afraid not when using current implementation.

MichalPrincNXP avatar Dec 16 '20 16:12 MichalPrincNXP

Hi. I think we have only complicated way to achieve this. User can create g_client1 g_client2... and before rpc call change g_client (g_client=g_client1, g_client=g_client2). Or have two transport layers and before rpc call assigned correct one (g_client.setTransport(transport1), g_client.setTransport(transport2)).

Not sure if it is good idea when arbitrator is used.

Hadatko avatar Dec 16 '20 17:12 Hadatko

Looks like same limitation also applies to the server side? Server only supports one transport layer, but can handle multiple services? Is that a valid statement? No simple way for a server to support two transport layers?

infn-ke avatar Dec 16 '20 19:12 infn-ke

Hi @infn-ke , Actually server is different case. You can have several server instances each with different transport layer. You can run every server in different thread. Or using poll function you can all controll in one thread.

Hadatko avatar Dec 22 '20 07:12 Hadatko

Is there a roadmap to fix the client context issue? Multi-client support from one process is quite common use case.

infn-ke avatar Jan 08 '21 13:01 infn-ke

I would do it in two step. First support multiple clients in C++ similar way as we do in Python. Then we can discuss if we need support C workround. Bellow is described what would change in source files.

Multiple clients

Hadatko avatar Apr 26 '22 10:04 Hadatko