Home arrow static arrow Java Programming [Archive] - Is RMI or Serialized Object over TCP better?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Is RMI or Serialized Object over TCP better?
This topic has 7 replies on 1 page.

Posts:104
Registered: 12/1/03
Is RMI or Serialized Object over TCP better?  
Jul 27, 2004 5:43 PM



 
Hi,
For networking, which one is better? Serialized Object over a simple socket connection or RMI?
What would be the advantages of each of them? Thx
 

Posts:648
Registered: 6/26/00
Re: Is RMI or Serialized Object over TCP better?  
Jul 27, 2004 5:50 PM (reply 1 of 7)



 
They seem to be used for different purposes as their names indicated.
RMI is for method calling over network.
Serialized Object (which becomes bits over the socket) is for saving objects over network.

RMI is built on top of serializing and socket. So RMI is at higher layer and for more specific usage. Bits over Socket is low level and give you better detail control.

--
 

Posts:18,384
Registered: 21.03.00
Re: Is RMI or Serialized Object over TCP better?  
Jul 27, 2004 11:36 PM (reply 2 of 7)



 
Hi,

Serialized objects over a socket is not just a way to save objects over network. As, you say -rmi is based on serialization over sockets. So you can pretty easy write your own "rmi" by just using serialized objects. That would however require more networking knowledge.

/Kaj
 

Posts:319
Registered: 11/8/00
Re: Is RMI or Serialized Object over TCP better?  
Jul 28, 2004 1:39 AM (reply 3 of 7)



 
Please do not cross post it cuts down the effectiveness of the fourms.

http://forum.java.sun.com/thread.jsp?forum=58&thread=541777
 

Posts:104
Registered: 12/1/03
Re: Is RMI or Serialized Object over TCP better?  
Jul 28, 2004 3:12 AM (reply 4 of 7)



 
So actually which one is better? I still thinking whether to use RMI or TCP for my networking part, what would be the advantages of use each of them?
 

Posts:18,384
Registered: 21.03.00
Re: Is RMI or Serialized Object over TCP better?  
Jul 28, 2004 3:24 AM (reply 5 of 7)



 
It all depends on your knowledge, and what problem you are trying to solve. Describe what you are going to build.

/Kaj
 

Posts:3,055
Registered: 18/06/98
Re: Is RMI or Serialized Object over TCP better?  
Jul 28, 2004 5:53 AM (reply 6 of 7)



 
If you really want to transmit less bytes, you can define a protocol using ASN.1, maybe BER or PER encoding. It's a daunting task; you can alleviate it with a ASN.1 toolkit like OSS Nokalva ones ( http://www.oss.com ).

If you just want to have your job done, use RMI/IIOP; all the hard work was done for you, and you get some things for free (like remote garbage collection, automatic loading of classes, etc.)

Simply opening a socket and superposing an ObjectOutputStream is possible, but you can have some surprises (because there are no remote garbage collection when you use your own schema, you will notice that slowly your memory will be wasted and wasted in objects that were sent, but are being referenced by a internal map in the ObjectOutputStream and ObjectInputStream objects, and never released...).

I mention ASN.1 because there is a proposal to lessen the network burden that XML imposes upon Web Services using ASN.1 encoding (called "Fast Web Services").
 

Posts:104
Registered: 12/1/03
Re: Is RMI or Serialized Object over TCP better?  
Jul 29, 2004 7:01 PM (reply 7 of 7)



 
Hi
I just did a research on the advantages of using rmi, here is the result:

1) RMI allows the Object Oriented paradigm to extend over the network, allowing cleaner designs
2) RMI allows both state and behavior to be passed over the network
3) RMI can simplify deployment and maintenance of distributed systems, since upgraded classes can often be served centrally, rather than having to be copied into place on all clients
4) RMI hides the wire protocols

I understand the first 3 points, but not the 4th point, can somebody give me an example?
 
This topic has 7 replies on 1 page.