Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Sockets and Internet Protocols and the fly likes java.net.ConnectException: Connection refused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java.net.ConnectException: Connection refused " Watch "java.net.ConnectException: Connection refused " New topic
Author

java.net.ConnectException: Connection refused

paul alcala
Greenhorn

Joined: Sep 05, 2004
Posts: 6
Hello, I'm just a newbie in socket programming. I made a simple socket program which accepts clients which is a chat program. But my problem is that when i execute the applet which is in the client side, i get the error java.net.ConnectException: Connection refused. I already changed the java.policy file permissions but it still doesn't work. Can anybody hellp me with this? I really need to fix the program. Thanks.
J Kneeland
Ranch Hand

Joined: Aug 15, 2004
Posts: 31
Are you calling accept() on your server socket?

Something like
paul alcala
Greenhorn

Joined: Sep 05, 2004
Posts: 6
Yes, that's part of the code. What i tried was i just tested the chat client locally in my pc and i can connect to it. But the problem is when run the client applet in other pc and connect to this local JBoss server, i get an error: connection refused
jeff willis
Greenhorn

Joined: Jul 29, 2004
Posts: 25
Can your client "ping" your server (and visa versa)?
paul alcala
Greenhorn

Joined: Sep 05, 2004
Posts: 6
i can't ping the main IP of the Linux Server. The scenario is this == I have a client server program using sockets in java. I deployed the .war file in the Linux server. The server program opens a port to listen for connections then accepts incoming connections. When i execute the Chat server program, it works fine. But when i run the chat client program, i always get Time out on linux server. And in the Web Browser, i get this error java.security.AccessControlException: access denied (java.net.SocketPermission ip ort connect,resolve). Please help me
jeff willis
Greenhorn

Joined: Jul 29, 2004
Posts: 25
If you can't ping your server, then your application won't be able to get to the sever either.

Sounds to me like some sort of fire wall protection or something like that.

Maybe it's just a "hosts" file that needs updated.
paul alcala
Greenhorn

Joined: Sep 05, 2004
Posts: 6
You're right. It's a firewall problem. Is there a way how to make a java socket connection to a linux port that has a firewall in it? If there is, can you tell me how to do it? Thanks in advance
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

The idea of a firewall is, to restrict access to the server.
Mostly you may set it up to deny
- specific IPs to connect
- connect on specific ports
- combination of both.

If you could bypass it, it would be useless.
You have to talk to the firewall-manager (linux-server admin), to allow access.


http://home.arcor.de/hirnstrom/bewerbung
paul alcala
Greenhorn

Joined: Sep 05, 2004
Posts: 6
I solved the problem already. I just configured the firewall of our linux server. Thanks a lot for the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.net.ConnectException: Connection refused
 
Similar Threads
JNDI and AD connection refused /connection timeout
java.net.ConnectException: Connection refused: connect
File trasfer between machines
URLConnection.connect does not work but openint a socket manually does.....
Help with Head First Java simplechatclient -- NullPointerException