• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

bring RMI and sockets

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I just wondering, about the real projects.
in which situation I must use the socket programming ?
in which situation I must use the RMI ?
at home, I always use swing, jdbc and other libraries.....
if we are using JDBC to connect to the database server (client and server model) so, in which time I use sockets, RMI ?
how the real projects use these technologies ?
I am trying to use these technologies when developing at home, but I don't know where ??
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,


I just wondering, about the real projects.
in which situation I must use the socket programming ?
in which situation I must use the RMI ?


It is difficult to say. Personally, if you need specific *treatment* on the data sending, say for performance, you will use socket. Because you can customize the data you send, including the data format. Just the receiver knows how to decode the data (object) is fine.
For RMI, you dont need to handle anything. Java provides APIs for serializing and deserializing the objects. However, you have no control on how the data is exchange.
Thus, the method you choose depends on what you wanna.


at home, I always use swing, jdbc and other libraries.....
if we are using JDBC to connect to the database server (client and server model) so, in which time I use sockets, RMI ?


IMO, you wont connect to the DB from client using JDBC. The responsibility of connecting to the DB should be resided on the server. Client makes a call, say retrive XXX data. The server receives such a request, and connect to the DB, retrieve XXX data on behalf of the client, and return the result. In such sense, both RMI and sockets work well.
The choice then falls on what is the return object you wanna. Serialized object or not. If not, you may need sockets. If yes, you can simply use RMI.


how the real projects use these technologies ?
I am trying to use these technologies when developing at home, but I don't know where ??


What do you wanna know? For myself, I worked with RMI in my SCJD assignment. You need to develop an interface to capture client request, and connect to the DB using either RMI or socket. I think you can simply write a Java application that connects to a daemon server using RMI or socket. Then you can try it at home.
You even dont need to have 2 machines. RMI can be connected by local (simulate the remote situation) by using the loopback address.
Hope this help.
Nick
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much....
can you give me a url for a tutorial that uses these technologies together (sockets, rmi, and advanced topics and builds a real project) ?
(I think, SCJD is great cert, I wish to take it) :roll:
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,
RMI Tutorial:
http://java.sun.com/docs/books/tutorial/reallybigindex.html#rmi
Socket Tutorial:
http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
I think the best real life project is the SCJD assignment.
Thus, you may consider to take it.
Nick
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more thing to help you choose:
Sockets are language-independent. You could write a Java client that talks to servers written in Java, C, VB, Perl, etc. or a server that accepts clients in all those languages. Frinstance, web servers open sockets.
RMI is Java to Java by default. I think you can coax it into interoperability with CORBA. Never had to try it.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


RMI is Java to Java by default. I think you can coax it into interoperability with CORBA. Never had to try it.


If you use RMI over IIOP, it can then interoperable with other languages. This is what EJB doing.
Nick
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot..
can you give a link to a tutorial (or a name of book) that uses all these technologies togehter?
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
There are rmi white papers, spec, and faq in official rmi web site.
reply
    Bookmark Topic Watch Topic
  • New Topic