The 1th exception is java.net.BindException:Address already in Use:jvm_bind. The exception occurs when the server side makes a new ServerSocket (port is a 0,65536 integer value) operation. The reason for the exception is that one of the ports like Port has been started and is listening. With the Netstat–an command, you can see a port with a listending state. You can solve this problem by looking for a port that is not occupied.
The 2nd exception is Java.net.ConnectException:Connection Refused:connect. This exception occurs when the client makes a new Socket (IP, port) operation because either the machine with an IP address cannot be found (that is, it does not exist from the current machine to the specified IP route), or the IP exists, but the specified port is not found for listening. This problem occurs, first check whether the client's IP and port is wrong, if correct, ping the server from the client to see if it can ping, if you can ping (service server to the ping ban will need another way), then look at the server to listen to the specified port program to start, This will certainly solve the problem.
The 3rd exception is the Java.net.SocketException:Socket is closed, which can occur on both the client and the server. The exception is due to the active shutdown of the connection (called the Close method of the socket) and read and write to the network connection.
The 4th exception is java.net.SocketException: (Connection reset or connect reset by Peer:socket write error). This exception can occur on both the client and server side. This exception is caused by two, the first is that if the socket at one end is closed (or if the active shutdown or shutdown due to an unexpected exit), the other end still sends the data, and the first packet that is sent throws the exception (Connect reset by Peer). The other is an exit, but the connection is not closed when it exits, and the other end throws the exception if the data is read from the connection (Connection reset). Simply speaking, it is caused by read and write operations after a disconnected connection.
The 5th exception is Java.net.SocketException:Broken pipe. This exception can occur on both the client and the server. In the first case of the 4th exception (that is, after you throw the Socketexcepton:connect reset by Peer:socket write error), the exception is thrown if you continue to write the data. The first two exceptions are to make sure that all network connections are turned off before the program exits, and that the next step is to detect the other person's shutdown connection and to close the connection itself after it closes.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service