Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connect to self the long way

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a client that opens a Server Socket and leaves it open all day. At some point, another machine can open a connection and send some messages. Some users have firewalls that prevent this from working. I'd like to detect this at client login, and I'm thinking I'd like the client to connect to itself. Probably a dummy question: Is there a syntax for my local port that forces a connect to it to go out through the network and back? Thanks!!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, don't believe so.

Why not just have the server try to connect to the client as soon as the client connects to it?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's high on my list right now because I haven't gotten into the books to look at how the client can call itself through the firewall. The normal use of this thing is async - one client broadcasts a message through the server to a subset of other clients matching some grouping criteria. Using the server to contact the client and report the results would be synchronous. That's not a problem even though it takes 30 or 60 seconds to fail, but it would be a new service. We also get some concern about bandwidth needs at logon from an offshore site. If it's the only way to do it, then so it goes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic