Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending a reference or an object?  RSS feed

 
Terje Ro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
john smith
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!