Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 285c6fe5

Přidáno uživatelem Oto Šťáva před téměř 4 roky(ů)

Re #8899 - Server - Implement variable-length message reception

Zobrazit rozdíly:

deltarobot-vr/Assets/DeltaRobotVr/Client.cs
265 265
                    {
266 266
                        ReadMessages(reader, writer);
267 267
                    }
268

  
269
                    if (client.Connected)
270
                    {
271
                        SendEot(writer, "Client stopped by user");
272
                    }
268 273
                }
269 274
                catch (Exception e)
270 275
                {
......
276 281
                    {
277 282
                        Debug.LogError($"Exception in communication thread:\n{e}");
278 283
                    }
279
                }

280
                finally

281
                {

282
                    IsConnected = false;

284
                }
285
                finally
286
                {
287
                    IsConnected = false;
283 288
                }
284 289
                
285 290
                // wait before reconnection - short polls to prevent blocking if application is closed
......
473 478
            writer.Write(PongId);
474 479
            writer.Write(pingValue);
475 480
        }
481

  
482
        private void SendEot(BinaryWriter writer, string reason)
483
        {
484
            writer.Write(EotId);
485
            writer.Write((UInt32) reason.Length);
486
            writer.Write(Encoding.ASCII.GetBytes(reason));
487
        }
476 488
    }
477 489
}

Také k dispozici: Unified diff