• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

java.net.ConnectException: Connection refused

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic