Exemplo n.º 1
0
 public static void Free(BaseClientMessage msg)
 {
     pool.Free(msg);
 }
Exemplo n.º 2
0
 public static void FreeSafe(BaseClientMessage msg)
 {
     safePool.Free(msg);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sends an unformatted message to the connected server.
        /// </summary>
        /// <param name="message"></param>
        protected void SendMessage(BaseClientMessage message)
        {
            if (!isConnected)
                throw new InvalidOperationException("Can't send message in disconnected state!");

            byte[] bytes = serializer.Serialize(message);
            lock (client)
            {
                NetOutgoingMessage sendBuffer = client.CreateMessage(bytes.Length);
                sendBuffer.Write(bytes, 0, bytes.Length);
                client.SendMessage(sendBuffer, message.DeliveryMethod);
            }
            BaseClientMessage.Free(message);
        }