Getting ConnectionTimeoutException with the host did not accept the connection within timeout

浪子不回头ぞ 提交于 2019-12-04 00:44:39

Your program will get a ConnectionTimeoutException whenever the server side does not "exist". A timeout of 10 seconds (10000 ms) is sufficient to work in most cases to connect between any processes even when located far apart (high latency).

There are many reasons why the client cannot get a connection:

  • The server process is not running.
  • The server process is not accepting connections.
  • The address or port that the client process used to connect is not correct.
  • Route to the server is not valid

Typically, though these result in quick failure responses because the server operating system or some router is able to respond with a failure. Here are some more that may apply directly to your situation:

  • Server physically off
  • Server or server process hung
  • Server physically disconnected from the network
  • Invalid destination address and the address does not exist on the network
  • Firewall rules blocking the outgoing route from the client
  • Firewall rules blocking the incoming route to the server

These kinds of problems usually result in the time out exception because there is no return message (the client operating system just has to give up and that is the reasons for having a timeout).

This list may not be complete but may help you in troubleshooting your problem. If you can provide additional information about your configuration and network and what you specifically would like help resolving, someone here should be able to give you more specific assistance.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!