Open saimukund opened 2 years ago
Hi eRPC user. Thank you for your interest and welcome. We hope you will enjoy this framework well.
Hi @saimukund, please take a look to #174
in the latest code, The tcp server exit immediately after communication with one client. While concurrent clients are not supported, server should be able to handle one client after other. isn't it?
In erpc_status_t TCPTransport::underlyingReceive(uint8_t *data, uint32_t size) if we comment below two lines, server can run in while(true) and serve multiple clients(one after other), but socket fd leak happens here. Is there a clean way to ensure server is always running?
erpc_status_t TCPTransport::underlyingReceive(uint8_t *data, uint32_t size) {
// code
// close socket, not server
close(false);
status = kErpcStatus_ConnectionClosed;
//code
}
while (1) {
erpc_server_run();
}
It resolved issue for clients connecting serially.
There seems to be a timing issue with this approach when a client request is send when server not yet open socket in "erpc_server_run()-> serverThread" this is leading to abort in client.
@MichalPrincNXP After every client - server transaction, tcp transport server is getting exit. I added while loop in my server to ensure server process always is alive and erpc server will receive message from clients continuously. But some times client aborts if server not ready.
while (1)
{
erpc_server_run();
}
Can you point when is server actually "ready" to receive client connection when we call erpc_server_run() ? I can try to synchronize the server with client using (named) semaphores.
Hello @saimukund , I think we have to focus on the correct behavior of the TCP transport layer and the erpc infrastructure first, instead of trying to workaround it by failing server re-running. Unfortunately there are currently no resources for this task but this has been identified as priority issue for the future. I am sorry.
Hi,
Is it possible to have single tcp server running and multiple clients calling rpc service?
talserver is my erpc server and taltest is the client which i am starting from a shell script as below.
I am getting below error when i try it.
/data/t1.sh 0 &
/data/t2.sh 0 &
/data/t1.sh 1 &
taltest: /home/saimukunds/erpc_develop/erpc/erpc_c/setup/erpc_client_setup.cpp:44: void erpc_client_init(erpc_transport_t, erpc_mbf_t): Assertion `transport' failed.
taltest: /home/saimukunds/erpc_develop/erpc/erpc_c/setup/erpc_client_setup.cpp:44: void erpc_client_init(erpc_transport_t, erpc_mbf_t): Assertion `transport' failed. Connection closed by foreign host.
I am trying to run the client in while loop to call server API. I created 3 instances of client here.