Esempio n. 1
0
        public void SendMessage(IBinarySerializable message)
        {
            try
            {
                if (Client == null || !Client.Connected || Stream == null)
                {
                    CrashAndReport(new Exception("There is no active connection!"));
                    return;
                }

                //Запаковываем сообщение и отсылаем
                message.SerializeBytes(Stream);
            }

            catch (Exception e)
            {
                CrashAndReport(e);
            }
        }
Esempio n. 2
0
        //Отправка сообщения в открытый поток
        public void SendMessage(IBinarySerializable message)
        {
            try
            {
                if (Client.Connected)
                {
                    message.SerializeBytes(Stream);
                }
            }

            catch (IOException e)
            {
                if (e.Message == "Unable to write data to the transport connection: An established connection was aborted by the software in your host machine.")
                {
                    Console.WriteLine($"[System] (SendMessage -> {Name}) {e.Message}");
                }
            }

            catch (Exception e)
            {
                Console.WriteLine($"[System] Some serious problems at SendMessage(IBinarySerializable message): {e.Message}");
            }
        }