java.net.ConnectException: Connection refused

  • Thread starter =?ISO-8859-9?Q?Kadir_Karaca_Ko=E7er?=
  • Start date
?

=?ISO-8859-9?Q?Kadir_Karaca_Ko=E7er?=

Hi,

i have something very strange here:

when i try to connect from my Client (written in Java) my Server (also
in Java) i get SOMETIMES
java.net.ConnectException: Connection refused

1. under Gentoo Linux and localhost:4444 NO EXCEPTION
2. under Knoppix + Debian Linux localhost:4444 NO EXCEPTION
3. windows 2000 localhost:4444 EXCEPTION!
4. all the tree systems IP.of.an.other.PC:4444 EXCEPTION!

Does anybody know why?

Another Client/Server Application (BabylonChat) runs well in any
Configuration!!

Have a nice Day.
Karaca
 
R

Rob Shepherd

Kadir said:
Hi,

i have something very strange here:

when i try to connect from my Client (written in Java) my Server (also
in Java) i get SOMETIMES
java.net.ConnectException: Connection refused

1. under Gentoo Linux and localhost:4444 NO EXCEPTION
2. under Knoppix + Debian Linux localhost:4444 NO EXCEPTION
3. windows 2000 localhost:4444 EXCEPTION!
4. all the tree systems IP.of.an.other.PC:4444 EXCEPTION!

Does anybody know why?

Another Client/Server Application (BabylonChat) runs well in any
Configuration!!

Have a nice Day.
Karaca
Windows Firewall software perhaps.
Windows may be blocking port 4444.

Rob
 
?

=?windows-1254?Q?Kadir_Karaca_Ko=E7er?=

netstat -a says the server is "Listening"
but client says "Connection Refused"

*confused*
Karaca
 
G

Gordon Beaton

i have something very strange here:

when i try to connect from my Client (written in Java) my Server (also
in Java) i get SOMETIMES
java.net.ConnectException: Connection refused

1. under Gentoo Linux and localhost:4444 NO EXCEPTION
2. under Knoppix + Debian Linux localhost:4444 NO EXCEPTION
3. windows 2000 localhost:4444 EXCEPTION!
4. all the tree systems IP.of.an.other.PC:4444 EXCEPTION!

Does anybody know why?

Please define "sometimes" with some numbers. Are you trying to connect
often, or only occasionally? Are there many clients, or just one? How
many existing connections are there to the same server when this
occurs?

Do both client and server correctly close all unused Sockets?

What is the (ServerSocket) backlog setting?

/gordon
 
?

=?windows-1254?Q?Kadir_Karaca_Ko=E7er?=

Gordon said:
Please define "sometimes" with some numbers.

The number are there:
---> Linux & Localhost No Problem

---> Windows & Localhost does NOT run.

Every combination of the Computers over LAN --> Connection refused.
Are you trying to connect
often, or only occasionally?

It happens evertime when i try to connect. --> I can not connect!
Are there many clients, or just one? How
many existing connections are there to the same server when this
occurs?

One Client. One Connection.
Do both client and server correctly close all unused Sockets?

No connection --> No unused Sockets :-(
What is the (ServerSocket) backlog setting?

Can you please explain it?


Karaca
 
G

Gordon Beaton

It happens evertime when i try to connect. --> I can not connect!

That isn't "sometimes".

Some things to try:

- Show the code where you create the ServerSocket. Which constructor
are you using? Did you bind the ServerSocket to the localhost
address? Dont!
- Show the result of ServerSocket.getInetAddress()
- Show the result of "netstat -a" or "netstat -an" on the server host
- Show the result of "telnet serverhost 4444" from a host where the
client fails to connect.
- Show the result of "traceroute serverhost" from a host where the
client fails to connect.
Can you please explain it?

The ServerSocket documentation should show how to set this value,
which represents the number of pending connections (incoming but not
yet accepted) the ServerSocket can handle. It's only relevant if you
are experiencing failures when there are large numbers of clients
attempting to connect at the same time, which doesn't seem to be the
case here.
 

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

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top