• 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

Sending a reference or an object?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, i have searched the web, tried for days to get this to work, but it doesn't. So i really hope someone can help a newbie.
1. A client on a remote machine creates a Person object.
2. The Server needs a reference or something to this object so that it can call methods on it.
How can i implement this? I am a newbie so i hope someone can explain this to me. The thing is that when I run the server and client on the same machine it works just fine, but when i put the client on a different machine it doesn't work.
Also, the client sucseeds in getting the reference from the server an calling a method wich returns a String.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't make a reference directly to an object instance in another JVM. To use a remote object you have to serialize the object, send it to the client, marshall it and do whatever you need to do with it. Have a look at Sun's RMI and J2EE tutorials to see the common ways this can be done.
 
Terje Ro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, i have discovered that i need to use rmi callback to do what i want. The server needs to know where the client is to send a message to it. Does anyone know of a good simple tutorial on this?
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic