• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

rmi chat

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
What would be the best way for the RMI server to uniquely
identify each client that logs on to it,(in addition to a user
name)? how can i connect two machines in two proxy environments(physically not connected)?how will my machine identify the other machine(since ip addreses of proxies need not be unique>).
please help me on this. i am developing a multiuser chat program.
thank you
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've got two choices; it depends on whether you want the unique per-client identifier held on the client or server side. (It's got to go somewhere; those are the only choices.)
If your remote clients all receive the same remote reference to your server class (that is, if you don't create any 1-per-client server-side objects), then you'll want to give each client instance a unique identifier that they pass to the server as a parameter in every remote method call. java.rmi.server.UID works well for this approach. You'll have to generate the UID on the server when the client first connects. You shouldn't generate it on the client for two reasons: 1) security, and 2) UID is only guaranteed unique with respect to the host its generated on.
If your server design uses a per-client proxy class, then identifying unique clients is easy. You use the proxy object itself as the identifier.
    Bookmark Topic Watch Topic
  • New Topic