Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am unable to connect to any host through Java programs, getting Connection refused.

Does it have anything to do with Ubuntu firewall configurations or any other setting? I am running Ubuntu 12.04 LTS

share|improve this question

Method1 First try to ping destination host , if host is ping-able it means client and server machine are in network.

Method2 Try connecting to server host and port using telnet. If you are able to connect means something is wrong with your client code. Also by observing telnet output you will come to know whether server is running or not or server is disconnecting the connection.

If you would like to know more about this error I mean why it is happening and how then please click the following

hope that helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.