Game development experience: disconnection, reconnection and abnormal network handling

table of Contents

 

1. The basis for the server to determine whether the client is online

2. Client exception handling

3. The design and implementation of client connection status

4. Some points to note about background switching and reconnection

5. Whether to discard the agreement


1. The basis for the server to determine whether the client is online


The pingpong protocol has been added. If there is no feedback within 5 minutes, the connection is lost

2. Client exception handling


Because the server will actively disconnect the client, the client will report an exception before reading and writing. After getting the exception, it will disconnect and reconnect.


3. The design and implementation of client connection status

 

Classification design of abnormal conditions

Separate design of client reconnection status

Implementation of the design of error code status

4. Some points to note about background switching and reconnection

The difference and specific use of OnApplicationFocus and OnApplicationPause

5. Whether to discard the agreement

When should I send and get the discarded protocol

Guess you like

Origin blog.csdn.net/osuckseed/article/details/108552926