1, Unknownhostexception:host (non-IP) can not know, will report the exception, www.google.com.hk Although the ping does not make sense, but will not report the error, because he is a real domain name. He's going to report connectionexception.
2, connectexception: generally IP or host or domain name is through, but the port is not through, will report the error. In addition, if the domain name exists, but the network if the restrictions, will also report the wrong. If the server does a limit on the number of connections, it will be reported if the client has too many simultaneous connections.
The configuration of the number of server connections is as follows: public serversocket (int port, int backlog, inetaddress bindaddr). The backlog is the maximum number of simultaneous connections the client has to limit parameters.
3. Sockettimeoutexception: This exception was introduced in my blog (the use of JAVA socket-free constructor method).
4, Bindexception: In general, the port is occupied, when the port is used again, the error will be reported.
Exceptions that may be thrown when a JAVA socket connects to a server