This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes SocketException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SocketException" Watch "SocketException" New topic
Author

SocketException

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

Let's BeNice, shall we? If not I will close this thread.

George, you've already been told that you can only connect to your LAN server while using the public IP address with NAT loopback enabled. Perhaps you don't understand why, but those are the clear facts, whether you like it or not. If you are unable to enable LAN loopback because your router / firewall does not support it, then there is nobody that can help you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Rob Spoor wrote:And I think that's where the problem lies. You're trying to connect from inside your LAN to outside your LAN to back inside your LAN. You need to enable LAN loopback for that to work.


And this point is where I feel the problem has not been clearly or consistently defined.

Rob's comment here and a couple of posts leading up to it sound to me like "client inside the LAN is trying to connect to server inside the LAN, but using the server's public IP address (which may be the server's actual public IP or may be the public IP of a NAT device that port fowards to the server)." Key point being, client trying to connect to a server on his own LAN, but not using the private LAN address.

The other interpretation I got was very different from this (though both problems may stem from related configuration issues). It sounded simply like a client outside the LAN (which is actually a server, but acting like a client here) was trying to connect to a server (which at other times acts like a client) inside the LAN, but that connection was being refused. This interpretation is how the problem sounds to at least two others in this thread and on OTN.

So, George, can you clarify which of the above two it is? Or if it's some third possibility I haven't yet gleaned?

Also, have you tried the itty bitty client and server code I provided in the other thread? What was the configuration (clearly and precisely please), what addresses did you use, and what results did you get?

And finally, I reiterate, that if you can connect at all--say with all parties on the LAN, all using private LAN addresses--then the problem has nothing to do with Java, and is purely a network admin issue.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

Jeff : from one greenhorn to another, please come back when you understand my issue.


Wow! Talk about ungrateful. I think George you don't like the response you have received rather than Jeff misunderstanding you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

Let's not keep a discussion about being nice here, shall we? That's already taken care of (or will be if it continues).
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

By the way, in case anybody is interested in the other half of this discussion (Or one of the other thirds, fourths, or Nths? I really don't know.) It's here: https://forums.oracle.com/forums/thread.jspa?threadID=2307439&tstart=0

We seem to possibly be on the verge of making progress over there, so I'm going to try to go back to focusing on that thread. I hate when discussions get splintered like this.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

George, please BeForthrightWhenCrossPostingToOtherSites next time. Both we and the users at the Oracle could have saved our time if we combined forces. This splintering that Jeff mentioned wouldn't have been as bad as it is now if you had told both us and the Oracle forum users about the thread on the other site.
George Bonfield
Greenhorn

Joined: Nov 07, 2011
Posts: 22
I need an interlocutor to be at the other end of my programme. Any takers? (Nothing bad will come of it). ;)
George Bonfield
Greenhorn

Joined: Nov 07, 2011
Posts: 22
I hadn't realised that a) there were posts here waiting (I have been offline, due to illness), and b) that my crossposting was so troublesome.

But c), I am now blinded by confusion. What I'd like to say there is that - believe it or not - I understand (and understood indeed), what you guys are trying to say, but somehow that has got lost in the fog (my fault I am prepared to accept).

The present position is that the code works fine, (after re-positioning the secondary server back in the server proper), but part of my original question still remains. If I may (and believe me i am not ungrateful for the comments that have been offered), I will rephrase the meaning of my question for you further consideration.

At this point, if any of you would be in a position to want to try out my code, I would be even more grateful.

Thanks

George.
George Bonfield
Greenhorn

Joined: Nov 07, 2011
Posts: 22
Rob Spoor wrote:Let's BeNice, shall we? If not I will close this thread.

George, you've already been told that you can only connect to your LAN server while using the public IP address with NAT loopback enabled. Perhaps you don't understand why, but those are the clear facts, whether you like it or not. If you are unable to enable LAN loopback because your router / firewall does not support it, then there is nobody that can help you.



I have to clear this one up, if no other issue for today.

I can connect to my LAN server from a client within my LAN which is *emulating* a remote client, by addressing the server via its public IP address. But, Rob, as far as I am aware, *no* NAT loopback is enabled. The only feature enabled on the router which can be said to generically resemble a loopback, is that the router has an inbound rule in operation to send all traffic on the appropriate ports to the LAN server (where *my* server code is running to pick it up). This arrangement I construe as Port Forwarding - (whether it is or not actually true port forwarding in a technical sense, you are all welcome to correct me on if you wish). But there is no formal setting nor implementation of any other kind of router or LAN-wide loopback going on anywhere here at all.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

George Bonfield wrote:
Rob Spoor wrote:Let's BeNice, shall we? If not I will close this thread.

George, you've already been told that you can only connect to your LAN server while using the public IP address with NAT loopback enabled. Perhaps you don't understand why, but those are the clear facts, whether you like it or not. If you are unable to enable LAN loopback because your router / firewall does not support it, then there is nobody that can help you.



I have to clear this one up, if no other issue for today.

I can connect to my LAN server from a client within my LAN which is *emulating* a remote client, by addressing the server via its public IP address. But, Rob, as far as I am aware, *no* NAT loopback is enabled. The only feature enabled on the router which can be said to generically resemble a loopback, is that the router has an inbound rule in operation to send all traffic on the appropriate ports to the LAN server (where *my* server code is running to pick it up). This arrangement I construe as Port Forwarding - (whether it is or not actually true port forwarding in a technical sense, you are all welcome to correct me on if you wish). But there is no formal setting nor implementation of any other kind of router or LAN-wide loopback going on anywhere here at all.


Yes, that is port forwarding.

As far as the LAN loopback, that wouldn't necessarily be something you'd have to enable; it may be enabled by default. Also, if I understand correctly, that issue would be addressed by routing rules and firewalls. So, for example, if the routing rules in play allow for a path from your starting point to the public IP address, and if you have not blocked connections along that route with some firewall, then, yes, you will be able to connect.

I think LAN loopback may have been an "if it's still not working after everything else is set up, look here..." kind of thing.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SocketException