Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Linux to WindowsXP TCP

Thread view: 
Dan McLeran - 09 Feb 2006 00:51 GMT
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();
        }
Luc The Perverse - 09 Feb 2006 01:12 GMT
> 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
[quoted text clipped - 4 lines]
> 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

:)
im - 09 Feb 2006 01:59 GMT
>> 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
[quoted text clipped - 6 lines]
>
> 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?
Dan McLeran - 09 Feb 2006 02:04 GMT
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 - 09 Feb 2006 02:01 GMT
>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 - 09 Feb 2006 16:20 GMT
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.
Nigel Wade - 09 Feb 2006 10:41 GMT
> 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
[quoted text clipped - 4 lines]
> 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?

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Dan McLeran - 09 Feb 2006 16:19 GMT
It was the firewall. I turned it off completely and now the 2 computers
talk with no problems. Thanks for the response.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.