This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI vs Sockets  RSS feed

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!