Hello Alexander,
I'm writing a server application which acts as a communicator between it's clients. Each of my sessions needs to know about other active sessions, so what I'd like to know is if there is a way to access the session object pool directly, or should I maintain my own list of running sessions?
In cases like this, we use the maintain a separate data structure. From my experience, the lookup of other sessions is mostly concerned about a certain property of the session object - not the session object as a whole. So it often make sense to give this property a separate name in the form of a type. For an example, you may take a look at the new TCP terminal server that comes with the Genode version 11.11. You can find it at:
gems/src/server/tcp_terminal/main.cc
Thanks, this worked perfectly! At first I didn't know how to start splitting functionality between my object and the server session, but as soon as I started doing it, it all came out naturally!
For use cases where we expect a lot of traffic, the overhead of chopping the payload in tiny messages is unfortunate. For this reason, the higher-level 'Terminal::Session' interface is designed to use a combination of a shared-memory buffer and signaling. Client and server share a dataspace that is allocated at the server-side when the session is created. The server does newer change the content of the dataspace except when explicitly asked by the client. If a client wants to output data, it writes its data to the dataspace and then informs the server to consume it via a synchronous RPC call. While the RPC call is in flight, the server copies-out the data and consumes it. Reading data works similar. The client explicitly asks the server to copy new data to the dataspace by issuing an RPC call. So the payload gets transferred via shared memory but client and server work synchronous.
I think, your example resembles this case, right?
Exactly. I suddenly realized that pure RPC is not intended for large data, when I tried sending a couple of Kbs! ;) I didn't use the Terminal::Session though, just took the parts I needed from it.
So, on the whole, everything works! Thank you very much!
A.D.