Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does server call clinet methods?

 
Elven Cao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to pass data between server and client. In RMI, client can call remote server methods, but how can server call client methods?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By reversing the normal process of passing a stub.
A server isn't so much a machine or a process -- it's a role that a program can play in a distributed environment. In this sense with RMI, a server is any process that exports a stub that can be passed to a client for use. A client is any process that is "aware" of the service interface and will use the stub to call on a server's methods.
A typical scenario might look like this:
1) One client process calls a server process and gets a stub.
2) The "initial client" passes a stub to the "initial server" as a parameter via one of the server's exported methods.
3) The initial server calls on the initial client via one of its exported methods, passing data as a parameter.
High-level view, but I hope it gives you the gist.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic