Unity3D Socket connected to C # server unity3D editor restarted connection unity3D editor instantly stuck

Source: Internet
Author: User

When the unity3D Socket and C # server are connected for the first time, the communication is normal. After the client segment is closed, the unity3D editor starts to connect to the unity3D editor again. The reason is that the Socket is asynchronous, asynchronous threads are not managed by Unity. This will cause Unity to remain in the handshake state with the Socket server, and the handshake cannot be established again on the server when the server is restarted.

My solution is to enable the exit function OnApplicationQuit () in the script, because my Socket is written in the Singleton, so my code is as follows. This is the truth.

Void OnApplicationQuit () {MySocket. GetInstance (). Closed ();}


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.