Edit: To be clearer, I basically need to differentiate between the different clients doing remote method invocation in objects stored in the server remote object registry. How could I do that?
And here is the situation:
I am currently in the process of creating a client/server command line interface application using Java rmi to exchange data (stored in Strings) between the clients and server.
I'm having problem whereas I must allow a client to send an authentication command with a user/pass. This authentication command (exemple: >user myUserName myPassword) must be sent through the same remotely called method used to send all the other commands for which the server must answer.
My problem : The client must, strictly, only send his commands and display the text result of his command received from the server. As simple a client as it gets, it has no state.
Since some methods requires the client to be logged in or have a different server-side implementation if the client is logged in or not, I need to to keep track of the client logged in state on the server(not a problem, I plan to simply keep a time stamp on each user in the user database and use a timeout) and must also differentiate between different clients.
Now, I think I have a good idea of how remote object works and I've been able to register a remote object on the server side and access a remote method from it using the client.
So, I need to do more, I must not only have client being able to access remote method, I also need the remote method(and the server running them) to know which network client is invoking this method(without passing the client username/pass as parameters in the remote method).
I think the rmiclientsocketfactory and rmiserversocketfactory must be customly used to do this, but I don't know how to proceed.
thanks you all for your time.