This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI client behind NAT. Callback implementation

 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my trick to perform RMI callbacks when client (server is not problematic) is behind a NAT.
It's based on keeping RMI client sockets opened, since client behind a NAT has not routable addresses.
The solution can be also an alternative to firewalled client environments, where only outgoing connections to popular ports are permitted.

Please read it, and post your ideas,comments,improvements,drawbacks...

Here is an example code, showing the basics:


Middle tier:
Remote interface:


Server event:


Server:


Client: Client starts a new thread for the server listener:


[ July 22, 2006: Message edited by: Oricio Ocle ]
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe some comments?
 
Jared Cope
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Originally posted by Oricio Ocle:
Maybe some comments?


Okay, I see what you are doing and I think it's a fine idea. I'm just wondering how I can adapt it to serve 70-80 clients that might connect to one server. I assume I would need to have a differnt mutex to synchonize on (and wait/notify) for each client that wanted to connect and be notified.

The scenario I need to solve is an observer pattern where there are different conditions to whether certain clients should be notified of something. Therefore a single mutex won't work for my case.

But just thinking about it, I can certainly see how I could adapt it to work. Very interesting idea. I'll definitely think more about it.

Cheers, Jared.
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But just thinking about it, I can certainly see how I could adapt it to work. Very interesting idea. I'll definitely think more about it.


Yes, it's easily adaptable to your case.
Think about it, I'll wait your comments..

Regards
 
Chris Janicki
Greenhorn
Posts: 21
Mac OS X Netbeans IDE Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also consider overriding RMISocketFactory. I posted some notes here:

Augur Systems: Java RMI Tips

I also corrected an error someone pointed out in the previous thread here.
 
Fors Judd
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the time limitations of this idea?
Will the Client eventually time out if the Server holds the call for 10 seconds? 100 seconds?
Is there a way to change the timeout limit?

Is the timeout dependable? Can the Client be programmed to count on a timeout after a given amount of time?

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic