O
Omega
I've been happily playing away with my client/server program for most
of this weekend. I decided earlier today to take it to the next step
and try running it on two machines.
....Boy did that not go over well.
The funny thing is, I did everything I could possibly thing of to make
the program real-network-ready. But then I got this:
-=-
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
-=-
Not descriptive, but okay, I did a google for this, and got hundreds
of:
"That error means you don't have a server running on that port."
I do. Trust me. I wrote the server, I had them communicating before.
The only time things started to go crazy was when I told the server
socket to bind to "getLocalHost()", and when I ran the client on a
different machine, pointing it to the server's IP.
Firewall? Nothing, no Windows firewall, no router, no frayed wires.
I've even tried by setting up a scenario where the server's IP is a
true internet IP address. No dice.
Both machines can ping each other, Samba works. I don't doubt my
connections for all the gymnastics I put them through (Yay SSH
tunnels!).
When I don't bind to "InetAddress.getLocalHost()"
-=-
TCP 0.0.0.0:2112 0.0.0.0:0 LISTENING
-=-
When I do bind to "InetAddress.getLocalHost()"
-=-
TCP MY.IP.AD.DY:2112 0.0.0.0:0 LISTENING
-=-
The only option for my clients at this point is to be told the IP
address of the server. Looking at the socket's code, whether I pass a
string or an InetAddress makes no difference as the socket turns it all
into an InetAddress anyway. So it's all the same.
That leaves the only variances in behaviour up to my server, which
because it was working over "localhost", I assume the bulk of the code
is sound.
Is there anyone out there who can help me figure out why my
client/server refuse to play together when my program is taken over
networks?
Keep in mind, EVERYTHING works when I code it all back to defaults and
it all seems to bind on "localhost".
I'm usually good for figuring things out myself, but there appear to be
a lot of dead end search results on this topic. Chalk it up as one of
Java's few undocumented quirks.
For anyone who wants the end-all-and-be-all solution to be available
for all to see, let's figure this one out. I've tried to clearly cover
all my bases here for good responses..
- Alexander Trauzzi
( Omega )
of this weekend. I decided earlier today to take it to the next step
and try running it on two machines.
....Boy did that not go over well.
The funny thing is, I did everything I could possibly thing of to make
the program real-network-ready. But then I got this:
-=-
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
-=-
Not descriptive, but okay, I did a google for this, and got hundreds
of:
"That error means you don't have a server running on that port."
I do. Trust me. I wrote the server, I had them communicating before.
The only time things started to go crazy was when I told the server
socket to bind to "getLocalHost()", and when I ran the client on a
different machine, pointing it to the server's IP.
Firewall? Nothing, no Windows firewall, no router, no frayed wires.
I've even tried by setting up a scenario where the server's IP is a
true internet IP address. No dice.
Both machines can ping each other, Samba works. I don't doubt my
connections for all the gymnastics I put them through (Yay SSH
tunnels!).
When I don't bind to "InetAddress.getLocalHost()"
-=-
TCP 0.0.0.0:2112 0.0.0.0:0 LISTENING
-=-
When I do bind to "InetAddress.getLocalHost()"
-=-
TCP MY.IP.AD.DY:2112 0.0.0.0:0 LISTENING
-=-
The only option for my clients at this point is to be told the IP
address of the server. Looking at the socket's code, whether I pass a
string or an InetAddress makes no difference as the socket turns it all
into an InetAddress anyway. So it's all the same.
That leaves the only variances in behaviour up to my server, which
because it was working over "localhost", I assume the bulk of the code
is sound.
Is there anyone out there who can help me figure out why my
client/server refuse to play together when my program is taken over
networks?
Keep in mind, EVERYTHING works when I code it all back to defaults and
it all seems to bind on "localhost".
I'm usually good for figuring things out myself, but there appear to be
a lot of dead end search results on this topic. Chalk it up as one of
Java's few undocumented quirks.
For anyone who wants the end-all-and-be-all solution to be available
for all to see, let's figure this one out. I've tried to clearly cover
all my bases here for good responses..
- Alexander Trauzzi
( Omega )