• 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

RMI vs Sockets

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I kind of have an idea how to implement a socket solution but not an RMI one. I am looking into doing it the RMI way since I have read that that is the easier option as you don't have to implement a threadsafe server as that is done for you (although I have read that the dissadvantage is that you can't use the thread's hashcode as the magic cookie). What I'd like to know is in the case of sockets the settings I would save to the .properties file on the client side are the ip address and port number of the server. For RMI what counterparts to this would I need to save?

Thanks
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For server:
Server port
db file location

For client:
port number client uses
server IP address

For Standalon
db file location...

Your Data.java that implements the interface they give you should be thread safe...
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by:

port number client uses



Is this the server's port the client wishes to connect to?
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Keith Jones:
What do you mean by:



Is this the server's port the client wishes to connect to?



Yep thats exactly what it is.
mark.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

you don't have to implement a thread-safe server



Oh, yes you do!
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. RMI does takes care of Multi-threading for you via an in built thread pool (ie you don't have to worry about to creating threads for each request). However it is still up to you to ensure that these RMI threads behave in a thread safe manner in your server code.

Mark.
[ January 25, 2007: Message edited by: Mark Smyth ]
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spank you all very much. I will try and implement the network layer now thanks for all the help guys. May God grant you all successful results in your exams.
 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before I entered this post, I want to find out the disadvantages and advantages of RMI and sockect respectively. But my requirement failed to meet.So could you talk on that differences in this post? In other word, why do you choose RMI instead of sockect, or maybe reversely.
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too lazy today to go into it however these are some good discussions of RMI vs Sockets here:

https://coderanch.com/t/181307/java-developer-SCJD/certification/RMI-vs-Sockets

https://coderanch.com/t/184461/java-developer-SCJD/certification/Perogi-asks-RMI-vs-Sockets

https://coderanch.com/t/184090/java-developer-SCJD/certification/Anybody-interested-sockets-discussion

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic