File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes RMI vs TCP/IP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI vs TCP/IP" Watch "RMI vs TCP/IP" New topic


Phani Kumar

Joined: Feb 15, 2002
Posts: 22
What are the benefits of using RMI over TCP/IP? I mean, if I want to merely pass some data to a server(it is not a web application) and get the response back, should I go for RMI with remote calls? Or it is more efficient to stick to TCP/IP sockets? Please advice.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

RMI provides a standardized, "object"-ized way to communicate over TCP/IP. It is (mostly) only for Java, though. So - if you need 2 or more Java programs to communicate, it's probably better to choose RMI (or a technology built on RMI that is appropriate to the needs of your project - such as EJB, Jini, etc.) - if you're going to be communicating with non-Java programs you'd need something else - straight TCP/IP socket communication, CORBA, or Web Services.

RMI makes it a lot easier to expand or change the network communication layer of your program - there may be slightly better efficiency using TCP/IP, since there are fewer objects (at least it sounds like the starting implementation would have fewer), but it's a lot easier to modify things when they need changed later.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
More efficient - in terms of what?
development time?
memory usage?
I agree. Here's the link:
subject: RMI vs TCP/IP
It's not a secret anymore!