• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Why use RMI when Socket programming can do it all?

 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to explain why you would do RMI programming if you could use sockets instead.

What are the advantages of RMI over sockets, and what's the fundamental differences?

Can you transmit objects over a network using sockets?
Which one is faster? (I know, speed kills)
Can you really say interactive communication is possible with sockets, as it is with RMI?

Just looking for some ammunition. Opinions would help.

Thanks!

-Cameron McKenzie
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I must say, I have programmed both with sockets and RMI/CORBA - both with the same objective in mind.

Sockets seem easier to control, where something like CORBA could take a lot of time to learn. RMI would limit you client to needing to be another Java application. In case you don't know, RMI is a Java only version of CORBA.


Sockets would limit your client applications to also being Java based if you choose to write objects across the stream (So in answer to your question, yes you can serialize and send objects across a network)

sockets could be client independent (c++,.NET, etc) if you choose to just write bytes across the network. However writing bytes you would need to make some sort of protocol for communications, this can be a lot of work, and if you get errors and need to debug problems by reading byte streams... your in for a tough time.

CORBA is good for business. It allows you to read and write objects, and call methods on remote objects, and its highly optimized, its a mature technology, having been around well over 10 years. It allows your Java application to communicate with ANY other client, c++, .NET, etc


My advice. If your programming games, chat programs, streaming media, file transfer use sockets and read/write bytes. You have tighter control over what is sent, you can optimize the streams, by buffering, or compressing date.

If you programming business applications which require remote method calls, use CORBA, (or if the client is definitly Java, you could use RMI). Corba however would be useless for lets say, file transfer, or any streaming type app.

Hope that helps
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One benefit would be that RMI works in terms of objects and method calls, whereas socket communication works on the level of bytes sent and received (leaving aside serializing of Java objects for the moment). So socket-based apps need to put some infrastucture in place to get to the level where RMI is at.

(As an aside, RMI can be made to interoperate with Corba by using the IIOP protocol instead of the (Java-only) JRMP protocol.)

I'm not sure I'd agree with the advice to use Corba. Although it's used in many places, it doesn't seem to go anywhere, and has a steeper learning curve and much higher infrastructure requirements. I wouldn't recommend it for new projects, and neither would I recommend RMI, for that matter.

Instead, Web Services have been gaining attention because of their cross-platform interoperability, and easy deployability (a WS engine needn't be more than a web app).
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much. That was great information - exactly what I needed.

I very much understand Dean's promotion of CORBA where many apps need to communicate. It has been a lifesend in the auto manufacturing field where we are putting together a bunch of components from different platforms. I also appreciate Ulf's comment that a future direction is to go with Web Services where possible. I just don't see those CORBA components at Ford being wrapped up in a Web Service any time soon.

"RMI is just a Java version of CORBA." I'm sure that'd upset SOMEBODY on the RMI teams at Sun Microsystems.

Thanks again!

-Cameron McKenzie
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic