Solved

RMI vs Socket Connection

Posted on 1997-07-25
6
2,123 Views
Last Modified: 2008-03-04
I would like to know the advantage of using RMI METHODOLOGY connecting  to the server over the SOCKET CONNECTION connecting to the server.  Is there any performance differences like speed, reliability... etc.

Because I am currently working in developing Java application implementing 3 tier architecture.
There is no database connectivity concept in this.

To fetch some info from lower tier to the uppermost tier
I feel RMI is better solution instead of Socket concept.

Some one please clear my doubt.

  Thanks in advance.
0
Comment
Question by:SBK
  • 4
6 Comments
 

Author Comment

by:SBK
ID: 1223818
Edited text of question
0
 

Author Comment

by:SBK
ID: 1223819
If I implement RMI my application is going to invoke a method in remote machine to do some sort of work.  I can accomplish the same by using java.io.* and java.net.* package.
How RMI is superior than SOCKET? or change by question like
What are the credits if I use RMI instead of normal SOCKET programming ?
0
 

Expert Comment

by:hleungta
ID: 1223820
From my experience there is no difference in term of speed
between both solution. They are both reliable.
Socket allows you to have clients written in C/C++ or any
other language and it's simple.
RMI : you must have Java client but if you have a lot of
    info. to transfer you will save a lot of time
     (you don't have to care about the protocol, parsing    
     your messages etc...). For OO programming this is
     a better solution
In conclusion, I prefer RMI because it is evolving !
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:SBK
ID: 1223821
Please tell me clearly the merits and demerits of RMI and Socket Connections ? It is not acceptable that "since because RMI is evolving it is better than Socket methodology "
0
 

Author Comment

by:SBK
ID: 1223822
Prolonged silence from Mr.Hleungta. Why?
Please suggest some sites where I can get info regarding my question ?
Thanks in advance
0
 
LVL 4

Accepted Solution

by:
russgold earned 100 total points
ID: 1223823
The chief advantage of RMI is that it is simple.  Since you are already presumably using object calls to make pieces of your system interact, RMI allows you to extend this across a network.  With sockets, you must explicitly transform invocations into messages and then interpret them on the other end. RMI does that for you.

Another very nice feature of RMI is the ability to pass objects by value. That is, you can pass an object reference to an object on another machine and have the remote object call your local object *even if the local object is a subclass which is not known to the remote object!*  Try doing that with sockets.

In general, RMI will be the preferred way to go for basic Java-to-Java distribution.

Now, if you cannot depend on the remote objects being Java, RMI will not work for you.  At that point, you might want to consider CORBA if you will be doing a lot of such work, or bite the bullet and use sockets if the server interaction is minimal.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
varialbe initialization 11 33
Configure a Bean in an XML file 4 32
Tomcat: Unable to run tomcat service. 2 20
JAVA API design with micro service cloud in mind 1 18
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question