Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.net.ConnectException: Connection refused

 
paul alcala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you calling accept() on your server socket?

Something like
 
paul alcala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can your client "ping" your server (and visa versa)?
 
paul alcala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
paul alcala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved the problem already. I just configured the firewall of our linux server. Thanks a lot for the help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic