Linux to WindowsXP TCP

Discussion in 'Java' started by Dan McLeran, Feb 9, 2006.

  1. Dan McLeran

    Dan McLeran Guest

    I'm having alot of trouble getting a Java app on a WindowsXP box to
    talk to a Java app on a RedHat Linux 9.0 box. It seems like it should
    be trivial but it's not working. My RedHat Linux box has 3 NIC cards in
    it, as does my WinXP box. I am attempting to hook 2 of the NIC cards
    together with a cross-over ethernet cable and open up a Socket between
    them. WinXP see the NIC card as being connected, but I cannot get the
    Linux box to establish a Socket with the server. I've put a couple of
    code snippets below just in case anyone sees anything obvious.

    I have the server running on WinXP:

    try {
    ServerSocket serverSocket = new ServerSocket(6969, 0,
    InetAddress.getByName("192.168.69.1"));

    System.out.println("listening on ip address " +
    serverSocket.getLocalSocketAddress().toString() + " port " +
    serverSocket.getLocalPort());

    Socket client = serverSocket.accept();

    System.out.println("Connected: " +
    client.getInetAddress().toString());
    }
    catch(final SocketException e) {
    e.printStackTrace();
    }
    catch(final IOException e) {
    e.printStackTrace();
    }

    And the client running on Linux under X windows:

    try {
    Socket socket = new Socket();

    socket.bind(new
    InetSocketAddress(InetAddress.getByName("192.168.101.1"), 6969));

    System.out.println("bound to " + socket.getLocalSocketAddress());
    System.out.println("bound = " + socket.isBound());

    socket.connect(new
    InetSocketAddress(InetAddress.getByName("192.168.69.1"), 6969), 1000);

    System.out.println("Connected: " + socket.isConnected());

    }
    catch(final SocketException e) {
    e.printStackTrace();
    }
    catch(final UnknownHostException e) {
    e.printStackTrace();
    }
    catch(final IOException e) {
    e.printStackTrace();
    }
    Dan McLeran, Feb 9, 2006
    #1
    1. Advertising

  2. "Dan McLeran" <> wrote in message
    news:...
    > I'm having alot of trouble getting a Java app on a WindowsXP box to
    > talk to a Java app on a RedHat Linux 9.0 box. It seems like it should
    > be trivial but it's not working. My RedHat Linux box has 3 NIC cards in
    > it, as does my WinXP box. I am attempting to hook 2 of the NIC cards
    > together with a cross-over ethernet cable and open up a Socket between
    > them. WinXP see the NIC card as being connected, but I cannot get the
    > Linux box to establish a Socket with the server. I've put a couple of
    > code snippets below just in case anyone sees anything obvious.


    Did you open the TCP ports in the firewall?

    --
    LTP

    :)
    Luc The Perverse, Feb 9, 2006
    #2
    1. Advertising

  3. Dan McLeran

    im Guest

    On Wed, 08 Feb 2006 18:12:42 -0700, Luc The Perverse wrote:

    > "Dan McLeran" <> wrote in message
    > news:...
    >> I'm having alot of trouble getting a Java app on a WindowsXP box to
    >> talk to a Java app on a RedHat Linux 9.0 box. It seems like it should
    >> be trivial but it's not working. My RedHat Linux box has 3 NIC cards in
    >> it, as does my WinXP box. I am attempting to hook 2 of the NIC cards
    >> together with a cross-over ethernet cable and open up a Socket between
    >> them. WinXP see the NIC card as being connected, but I cannot get the
    >> Linux box to establish a Socket with the server. I've put a couple of
    >> code snippets below just in case anyone sees anything obvious.

    >
    > Did you open the TCP ports in the firewall?


    Can you ping the server from the client machine? Are there any other TCP based
    servers (http, telnet, ftp, pop etc) running on the XP server that you can
    connect to with telnet or a web browser, from the client machine?
    im, Feb 9, 2006
    #3
  4. Dan McLeran

    Dan McLeran Guest

    >Did you open the TCP ports in the firewall?

    That's a good point. I'm not sure what state the ports are in. Does the
    firewall apply to all NIC cards? One of my NIC cards on each machine is
    used to access the outside world. The NIC cards within the confines of
    this discussion do not. The idea is that they would be in a closed,
    local network where everyone knows everyone else's ip address. But I'm
    not sure if the firewall cares about that, probably not.

    Thanks for the response.
    Dan McLeran, Feb 9, 2006
    #4
  5. Dan McLeran

    Dan McLeran Guest

    I didn't try that yet. I was using some Java examples I found on the
    web and thought it would work str8 away. I'll try to ping tomorrow and
    see what I get.
    Dan McLeran, Feb 9, 2006
    #5
  6. Dan McLeran

    Nigel Wade Guest

    Dan McLeran wrote:

    > I'm having alot of trouble getting a Java app on a WindowsXP box to
    > talk to a Java app on a RedHat Linux 9.0 box. It seems like it should
    > be trivial but it's not working. My RedHat Linux box has 3 NIC cards in
    > it, as does my WinXP box. I am attempting to hook 2 of the NIC cards
    > together with a cross-over ethernet cable and open up a Socket between
    > them. WinXP see the NIC card as being connected, but I cannot get the
    > Linux box to establish a Socket with the server. I've put a couple of
    > code snippets below just in case anyone sees anything obvious.
    >


    It would be interesting to see the IP assignments of the various network cards,
    and the corresponding routing tables.

    Can the two machines communicate in other ways?

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
    Nigel Wade, Feb 9, 2006
    #6
  7. Dan McLeran

    Dan McLeran Guest

    It was the firewall. I turned it off completely and now the 2 computers
    talk with no problems. Thanks for the response.
    Dan McLeran, Feb 9, 2006
    #7
  8. Dan McLeran

    Dan McLeran Guest

    That was it! I turned off the firewall completely and it works. Now I'm
    gonna go back and only enable what I need to enable to keep it working.

    Thanks for the help.
    Dan McLeran, Feb 9, 2006
    #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. SpamProof
    Replies:
    0
    Views:
    554
    SpamProof
    Oct 21, 2003
  2. Andrius B.

    ASP on WindowsXP

    Andrius B., Feb 7, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    410
    Andrius B.
    Feb 8, 2006
  3. Replies:
    1
    Views:
    448
    Roedy Green
    Nov 2, 2005
  4. Rob Mitchell
    Replies:
    0
    Views:
    2,180
    Rob Mitchell
    Jan 25, 2006
  5. Tiger
    Replies:
    5
    Views:
    968
    Dave Thompson
    May 1, 2006
Loading...

Share This Page