Exception: Software caused connection abort: Socket write error

Source: Internet
Author: User

Java. SQL. sqlexception: Io exception: Software caused connection abort: Socket write error

 

 

Today, I wrote a broadcast program. There was no problem when I tested it in Java, but the following error was reported during the test with the flash client. After a long time, I couldn't find the cause of the problem. It turns out that Flash software does not automatically create a new thread every time it starts a new client connection like a Java client during testing. Flash closes the connection of the client that was last started every time a new client is restarted. That is to say, the last socket is closed. In this way, when the Java server sends a message to the client, the connection to the client has been closed, so it is naturally unable to receive the message, resulting in a "connection abort" error in Java, in this case, you cannot perform write operations. The cause of this exception is that the client is shut down abnormally or the user is disconnected due to network problems. Therefore, the Java Server should detect the connection status of the client in real time, no matter what causes the user to be disconnected, the user must be deleted from the user's online list. Otherwise, the server will not work properly. In severe cases, the server may die due to blocking, this should be noted.

 

The best way to solve this problem is to check the connection status of the online user from time to time. Once a connection problem is found, the user is immediately forced to publish the online user list, or delete it from the user queue to be broadcast. In this way, you can ensure that the server does not encounter exceptions during server broadcast due to abnormal user exit.

 

The following is the exception details:

Java. SQL. sqlexception: Io exception: Software caused connection abort: Socket write error:

Java.net. socketexception: Software caused connection abort: Socket write error

At java.net. socketoutputstream. socketwrite0 (NATIVE METHOD)

At java.net. socketoutputstream. socketwrite (unknown source)

At java.net. socketoutputstream. Write (unknown source)

At com. toplx. Game. server. sendmessage. sendobject (Sendmessage. Java: 40)

At com. toplx. Game. server. broadcastmsg. sendmsgtoall (Broadcastmsg. Java: 42)

At com. toplx. Game. server. gamethread. Run (Gamethread. Java: 53)

At java. Lang. thread. Run (unknown source)

 

Related Article

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.