Different network exception and their causes

In client server communication, typically one will get subclass of IOException if there is connection issue between the client and server.  Based on the exact exception one can determine the possible causes.

Java application gets  java.net.UnknownHostException: spatel because of following reasons,

  1. Cannot perform DNS lookup because of network issue
  2. Some of issue with DNS server itself
  3. Host’s IP address cannot be determined by DNS.

(The server url in this case was https://spatel:443/testapp)

Java application gets  java.net.NoRouteToHostException: No route to host: connect because of following reasons

  1. When client is not able to reach the server because either server or intermediate router is down
  2. Some sort of network issue.

Java application gets  java.net.ConnectException: Connection refused: connect because of following reasons

  1. When client is able to ping server but the said service is not running on the specified port.
  2. May be server is down or under maintenance.

Java application gets java.net.SocketException: Connection reset because of following reasons

  1. When server terminates the connection abruptly instead of sending the complete response and then properly terminating the connection.
  2. Server goes down while processing the request.

Java application gets java.net.SocketTimeoutException: Read timed out because of following reasons

  1. Client has specified read timeout or socket timeout on connection and server does not respond before this time out occurs.
  2. This may indicate the socket\read timeout on client is short, so the server is not responding as per agreed SLA.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s