Solved

RMI vs Socket Connection

Posted on 1997-07-25
6
2,056 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
Comment Utility
Edited text of question
0
 

Author Comment

by:SBK
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:SBK
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now