Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

RMI: how to get client info?

Thread view: 
linuxadmin@yandex.ru - 14 Jun 2007 10:33 GMT
hello!

how can my RMI server get information about connected clients?
i found only the method inside the class RemoteServer named
'getClientHost'.
but it returns just a stupid string with the IP address.

i would like to be able to distinguish which client makes a remote
method call.
my idea was, that an ip address AND a port number would identify a
client.
or are there any better possibilities to distinguish between RMI
clients?

thanks in advice!
Esmond Pitt - 15 Jun 2007 02:12 GMT
> 'getClientHost'.
> but it returns just a stupid string with the IP address.

It returns a string with the IP address. Stupidity is strictly in the
eye of the beholder.

> i would like to be able to distinguish which client makes a remote
> method call.
> my idea was, that an ip address AND a port number would identify a
> client.

Well, what's a client? RMI will use a different TCP local port number at
the client end depending on whether it is reusing the same connection or
starting a new one, which it does for reasons hidden under the hood of
RMI. One of those is two threads calling the same server at the same
time. This will use two connections, and therefore two ports. Is that
one client, or two? What about two independent applications in the same
JVM? is that one client or two? What about two JVMs in the same client
host? What about a single thread in a single thread which makes two
calls an hour apart which use two separate connections and therefore two
port numbers? Is that really two clients?

All in all I think identifying clients with IP addresses is as sensible
as anything. Qualifying them by port number as well is pretty meaningless.
linuxadmin@yandex.ru - 15 Jun 2007 12:21 GMT
On Jun 15, 3:12 am, Esmond Pitt <esmond.p...@nospam.bigpond.com>
wrote:

thank you for a such detailed reply.

> All in all I think identifying clients with IP addresses is as sensible
> as anything. Qualifying them by port number as well is pretty meaningless.

could you suggest a better possibility please?

i really don't want to let the clients tell by themselves who they
are, this concept could be spoofed.
Lew - 15 Jun 2007 12:39 GMT
> On Jun 15, 3:12 am, Esmond Pitt <esmond.p...@nospam.bigpond.com>
> wrote:
[quoted text clipped - 8 lines]
> i really don't want to let the clients tell by themselves who they
> are, this concept could be spoofed.

Certificates.  PKI.

Signature

Lew

Allan Valeriano - 15 Jun 2007 18:00 GMT
> i would like to be able to distinguish which client makes a remote
> method call.

Take a look at the class ThreadLocal. You can declare a
ThreadLocal<User> inside the server and then on every server call, you
call a method like:

public void setAccessUser(User user)
{
 localThread.set(user);
}

and specify who is calling.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.