SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
George Bonfield wrote:Thing is, when the server is sitting on port 30312 on the LAN, the clients' IPs are all LAN addresses - aren't they? Where's the NAT in that?
George Bonfield wrote:Sorry - did I miss something here?
I am already running a server over the internet - the rest of this application serves clients over the internet. Did you not understand that originally?
The problem is that in one particular method, it is convenient and desirable for the server to call a serversocket on a client (we don't need to discuss why that is).
Okay. So let me ask you a theoretical question: You're running a server which accepts connections from clients on the Internet. So would you expect to be able to accept a connection from the computer I'm using right now?
And if so, would you expect to be able to connect back to it (assuming your application was running here) in the way you are wrestling with now?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
George Bonfield wrote:In any case, I expect my code *would* work if it were served on this machine, connected to your machine on a true remote IP, and then tried to connect back to this server using your public IP - that would work.
As for a proxy server, I don't know where that fits into anything.
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.
George Bonfield wrote:
You need to enable LAN loopback for that to work.
AFAIK, there is no way to implement a LAN-wide loopback, - (which AFAICS would only mirror the entire problem down the hallway) - only a single-machine loopback is possible. Kick me if I'm wrong.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
George Bonfield wrote:Your interface would then for some business reason we don't need to rehearse here, offer you the option of doing some other task with my server, for which another socket needed to be opened. At this point, the most convenient way of getting that link up and running quickly and according to the stochastic nature of the decisionmaking process on the client, is over a socket which your client needs to wait for - ie it needs to open a Serversocket. Your client obtains my server's IP from the socket address of one of the other already open sockets, and uses it along with a predefined port, to wait for the server to request an .accept() your end, and transfer a Vector via an ObjectOutputStream. None of this is rocket science, and none of it should surpise nor overhaul the capabilities of the routers to identify and resolve the origins and destinations of the packet exchange. And that's why it would all work between our machines, despite you not evidently having a public IP.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
George Bonfield wrote:Thanks. I won't be fiddling with my firewall however.
I don't profess to be an arch techie, and some low-level knowledge of router circuitry and IP packets eludes me. But one thing, as a programmer, I do know, and that is that if a contingency exists, then you have to accommodate (provide for) it within your system. This is clearly something that NAT technology fails in
As I said in my previous so-called 'hand-waving posts' - (waving always being preferable to reciprocation) - if the thing works in a LAN, then at that point, my job ought to be over.
George Bonfield wrote:OK, so I wasn't expecting 'ipAddr' to be the same IP (the public one) as the client connected to the server on - but it is. I expected ipAddr to be 192.168.0.2.
George Bonfield wrote:I live in a house.
etc.
Me wrote:
Do you understand the difference between public and private IP addresses? In particular, do you understand that there can be thousands of computers with the IP of 192.168.0.2, and that that IP is ONLY meaningful on a LAN, and cannot be used from outside that LAN to address a computer on that LAN?
George Bonfield wrote:Yep -I absolutely understand those IP differences. And if you'd read my posts properly, you'd realise that I knew that, and that I'm not contending that is my problem.
I'm don't need nor attempt to send my private IP to any part of the programme or the internet,
least of all the server,since it will obtain it from the socket connection,
putting it de facto out of my hands, unless I have some reason to query the socket for it later.
George Bonfield wrote:One day, just for fun, I decide to spend all my money on a stamp, and write a 'proper' letter to myself. I get someone on the street to post it for me.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
George Bonfield wrote:Actually my guardian doesn't need to read the address on my outgoing stamped mail, because that will get done in the sorting office. All he needs to do is to keep a count of the number of letters I send, and as long as the count of letters back to me is <= the number of letters I send, then he's happy. But should an extra one arrive, he bins it.
Jeff : from one greenhorn to another,
please come back when you understand my issue.
Consider Paul's rocket mass heater. |