Socket Won't Connect

Discussion in 'Java' started by Chase Preuninger, Apr 30, 2008.

  1. 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);
    Chase Preuninger, Apr 30, 2008
    #1
    1. Advertising

  2. Chase Preuninger wrote:
    > 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?

    --

    Knute Johnson
    email s/nospam/linux/

    --
    Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
    ------->>>>>>http://www.NewsDem
    Knute Johnson, Apr 30, 2008
    #2
    1. Advertising

  3. Chase Preuninger

    Nigel Wade Guest

    Chase Preuninger wrote:

    > 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.

    --
    Nigel Wade
    Nigel Wade, Apr 30, 2008
    #3
  4. Chase Preuninger

    Mark Space Guest

    Chase Preuninger wrote:
    > 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.
    Mark Space, Apr 30, 2008
    #4
  5. 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?
    Chase Preuninger, Apr 30, 2008
    #5
  6. Chase Preuninger wrote:
    > If there was a firewall in the way wouldn't there be a messages that
    > pops up when I try to connect.


    Not necessarily. Most boundary firewalls don't send messages back to
    clients. Your client program could pop-up a message if the connection fails.

    > Also what is a proxy?


    http://en.wikipedia.org/wiki/Proxy_server


    --
    RGB
    RedGrittyBrick, Apr 30, 2008
    #6
  7. Chase Preuninger

    Mark Space Guest

    Chase Preuninger wrote:
    > 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?


    <http://en.wikipedia.org/wiki/Ping>
    Mark Space, Apr 30, 2008
    #7
  8. Chase Preuninger

    EJP Guest

    Chase Preuninger wrote:
    > 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.
    EJP, May 1, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Nagy
    Replies:
    1
    Views:
    4,753
    Mark Wooding
    Jan 27, 2009
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    940
    Jean-Paul Calderone
    Jan 27, 2009
  3. Laszlo Nagy
    Replies:
    0
    Views:
    524
    Laszlo Nagy
    Feb 1, 2009
  4. Steve Holden
    Replies:
    0
    Views:
    641
    Steve Holden
    Feb 1, 2009
  5. Florian Berger

    Python socket won't connect on Windows

    Florian Berger, Oct 22, 2009, in forum: Python
    Replies:
    2
    Views:
    1,035
    Florian Berger
    Oct 22, 2009
Loading...

Share This Page