• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass an object using RMI over the network from the server to the client

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sir,
I want to know how to pass an object using RMI over the network from server to the client by stating an example with sample code.



Regards....
Nayeem.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mohd Nayeemuddin:
I want to know how to pass an object using RMI over the network from server to the client by stating an example with sample code.



Hi Mohd,

This question is no way related to JDBC.You could have posted it in Distributed Java form to get better response.

You can find numerous examples in the internet for this.You can have a remote method returning a object.

This explains about RMI with example code.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reading the RMI tutorial is indeed the best first step.

Note, however, that there is a flaw in the question that you ask. In neither ordinary Java nor RMI do you "pass an object". You pass references to objects. In RMI, this is complicated by the fact that the object references you use on the client side are in fact references to proxies for objects that exist on the server side.

Well, actually, I am very rusty on RMI, but I don't think it has any special way to pass objects by value, because its whole idea is to allow you to write code that looks like ordinary Java, but where some of the objects are actually implemented remotely.

I do use CORBA, which has such facilities, though I don't use them; Google "corba value type" for information.
[ July 12, 2007: Message edited by: Peter Chase ]
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In RMI "Remote" objects are passed by reference; "Serializable" objects are passed by value.

As far as passing them from the server to the client - this could either be done as making the object the return value of a method that the client calls on the server (easy way), or it could be done as a "client side callback" where the client "registers" with the server, and the server calls a method on the client passing the object as a parameter (more involved way).
[ July 12, 2007: Message edited by: Nathan Pruett ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic