Java.net.ConnectException:Connection refused problem solving method _java

Source: Internet
Author: User

Socket exception

Client exception

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.

Java.net.SocketException:Socket is closed

Often the reason is that the self has actively closed the connection (called the Close method of the socket) and then read and write to the network connection.

Java.net.SocketException: (Connection reset or connect reset by Peer:socket write error)

The first is that if one end of the socket is closed (either actively or closed due to an unexpected exit), the other end 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.

Java.net.SocketException:Broken Pipe.

Throw Socketexcepton:connect Reset by Peer:socket write error, throw the exception if you continue to write the data

(not yet detected)

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.

Java.net.SocketException:Socket is closed

(with Client)

Java.net.SocketException: (Connection reset or connect reset by Peer:socket write error)

(with Client)

Java.net.SocketException:Broken Pipe.

Thank you for reading, I hope to help you, thank you for your support for this site!

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.