Socket Won't Connect

C

Chase Preuninger

Does anyone have any idea why when I create socket connections like
shown they only really work when I test them on my local machine or
when I test them on 2 computers on my wireless network. Other than
that I can't get a peer to peer connection to work.

Socket s = new Socket(Some InetAddress Object, Some Port);
 
K

Knute Johnson

Chase said:
Does anyone have any idea why when I create socket connections like
shown they only really work when I test them on my local machine or
when I test them on 2 computers on my wireless network. Other than
that I can't get a peer to peer connection to work.

Socket s = new Socket(Some InetAddress Object, Some Port);

Do you have a firewall in the way?
 
N

Nigel Wade

Chase said:
Does anyone have any idea why when I create socket connections like
shown they only really work when I test them on my local machine or
when I test them on 2 computers on my wireless network. Other than
that I can't get a peer to peer connection to work.

Socket s = new Socket(Some InetAddress Object, Some Port);

Given that you haven't told us either the IP address or the port in question,
then no, I don't know. All I can do is guess.

There are 3 things I can think of which might be getting in the way. There is no
route between the two IP addresses. The user running the code doesn't have
sufficient privilege to open the port requested. There is a firewall blocking
the connection.
 
M

Mark Space

Chase said:
Does anyone have any idea why when I create socket connections like
shown they only really work when I test them on my local machine or
when I test them on 2 computers on my wireless network. Other than
that I can't get a peer to peer connection to work.

Socket s = new Socket(Some InetAddress Object, Some Port);

Not enough info. Show us how you are actually calling this when if
fails. SSCCE please.
 
C

Chase Preuninger

If there was a firewall in the way wouldn't there be a messages that
pops up when I try to connect. Also what is a proxy?
 
E

EJP

Chase said:
Does anyone have any idea why when I create socket connections like
shown they only really work when I test them on my local machine or
when I test them on 2 computers on my wireless network. Other than
that I can't get a peer to peer connection to work.

As you haven't provided the exception message or the stack trace, no, I
have no idea.

The exception tells you *exactly* why:

ConnectException 'connection refused': somebody issued an RST, either
the target host, in which case nothing is listening at the port, or an
intermediate firewall, in which case you violated the firewall rules.

ConnectException 'connection timeout': most probably an intermediate
firewall is dropping you on the floor.

NoRouteToHostException: self-explanatory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top