private void SendMessageToServer(Message m) { if (!connection.SendMessage(m)) { throw new Exception("Connection lost, can't send message"); } }
public bool SendMessage(Message msg) { lock (locker) { bool sent = client.SendMessage(msg); if (sent) { System.Console.WriteLine($"[client {Id}] sent message {msg.GetType().Name}"); } return(sent); } }