Ejemplo n.º 1
0
        /// <summary>
        /// Sends given net command to the server
        /// </summary>
        /// <param name="command"></param>
        public void Send(NetCommand command)
        {
            using (MemoryStream str = new MemoryStream(0))
            {
                BinaryWriter writer = new BinaryWriter(str, System.Text.Encoding.Unicode);
                command.Write(writer);
                writer.Flush();

                Send(str.ToArray(), 0, command.Id);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets given command to the server
        /// </summary>
        /// <param name="command"></param>
        public void Send(NetCommand command)
        {
            if (SocketStatus != SocketStatus.Connected)
            {
                return;
            }
            command.Status = CommandStatus.SendingToTarget;
            using (MemoryStream str = new MemoryStream(0))
            {
                BinaryWriter writer = new BinaryWriter(str, System.Text.Encoding.Unicode);
                command.Write(writer);
                writer.Flush();

                Send(str.ToArray(), 0, command.Id);
            }
            command.Status = CommandStatus.WaitingForResponse;
        }