Connection Refused: Connect

All, any assistance much appreciated (apologies I am very rusty with Java)

Java 1.5.0_11 Windows XP SP2.

Connection refused when trying to connect to a local network device on same subnet as PC. Makes no difference whether firewall on or off, or whether security policy set or not. The connection refused message is coming from the underlying operating system or Java permissions to IP ports rather than the network device as I can achieve a connection on another XP SP2 PC connected to the same device and patched to the same level.

Same Java version on both, same IP routes, same network configuration (different fixed IP addresses), able to resolve localhost and remote IP addresses on both, Netcat working, Hyper Terminal working. All Java permissions set low, same environment variables on both, appropriate IP ports free, connection refused irrespective of whether port listening or not. DNS resolving ok, arp cache correct, IP routes correct.

java.net.ConnectException: Connection refused: connect

at sun.nio.ch.Net.connect(Native Method)

at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)

Is there a fundamental problem with Java 1.5.0_11 and Windows XP SP2?

Regards

Ralph

[1247 byte] By [Ralphja] at [2007-11-26 20:36:44]
# 1
Well, from the same machine that has the problem, can you connect to the network device using a different program (i.e./e.g. telnet)?
masijade.a at 2007-7-10 1:30:19 > top of Java-index,Core,Core APIs...
# 2
Hello masijadeYes, Telnet, Netcat and Hyper Terminal all connect to the device from the PC that Java refuses to connect from. It has to be a permission or a policy somewhere, he says confidently.RegardsRalphj
Ralphja at 2007-7-10 1:30:19 > top of Java-index,Core,Core APIs...
# 3

By firewall on or off, do you mean the Windows Firewall, or a firewall on the other network device?

AFAIK, there is no fundamental problem with Java and XP (at least as far as networking goes), but will probably want to search the Bug Database (which you probably already should have done anyway).

Edit: and sorry missed the mention of netcat and hyperterminal (or they at least didn't register on the first read) for my first post.

Edit: Or possibly a firewall on any devices in between.

masijade.a at 2007-7-10 1:30:19 > top of Java-index,Core,Core APIs...
# 4

Thanks for the prompt reply.

Windows Firewall off, no other Firewall and no router and the second PC running on the same network can see the device using a Java connection. So an 'internal Java issue' somewhere on the PC that is not working. I will continue searching the bug databases.

Regards

Ralphj

Ralphja at 2007-7-10 1:30:20 > top of Java-index,Core,Core APIs...
# 5
Does something like this help? -Djava.net.debug=all
BIJ001a at 2007-7-10 1:30:20 > top of Java-index,Core,Core APIs...
# 6

Hello BIJ001

Excuse my ignorance. Can I add that line to my Java command line rather than appending debug to my class files (I would rather not change any files at this time).

My current command line is java -classpath . (then the path to my 2 IP connection class files).

Regards

Ralphj

Ralphja at 2007-7-10 1:30:20 > top of Java-index,Core,Core APIs...
# 7
Well, -D is a comman line switch, so yes, you put it on the command line before naming the Class to run.
masijade.a at 2007-7-10 1:30:20 > top of Java-index,Core,Core APIs...
# 8
'Connection refused' comes from the operating system's TCP/IP stack. It has nothing to do with Java or Java permissions. If it did there would be different exception.Can you telnet to that host and port from the client machine?
ejpa at 2007-7-10 1:30:20 > top of Java-index,Core,Core APIs...