logo       

Identifying Client Callbacks: msg#00001

java.sun.rmi

Subject: Identifying Client Callbacks

I'm creating an example of client callback of Java RMI to understand how it
works.
But i've some problems.

I've 1 Server and N clients.
It has to work similarly to an IRC server.

Server Remote Methods:

login(String nickname, String password, ChatClientInterface clientlink)
logout(ChatClientInterface clientlink)

Client Remote Methods:

join(String nickname)
part(String nickname)


In few words.. a client call the server method

login("mynick", "mypass", this);

(with "this" I pass the reference to the client interface)
Ok.. server receive this call, check if "mynick" and "mypass" are correct,
and if yes, it stores in a list the reference to that client interface.

in a second moment.. when client wants to logout it calls:

logout(this);

The server receive this call, it have to search for which is the "nickname"
asked to logout, and for doing this I though to scroll my list of "interface
links" and watch when I found a matching one!

The problem is that it never matches...

In few words, I cannot use the client interface link to identify the UNIQUE
client who is calling the remote method on the server?
What is the best way to understand which of the N client is invoking the
remote method on server?

Thank you very much

Fabio Gandola

===========================================================================
To unsubscribe, send email to listserv@xxxxxxxxxxxx and include in the body
of the message "signoff RMI-USERS". For general help, send email to
listserv@xxxxxxxxxxxx and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise