Beispiel #1
0
 /// <summary>
 /// Broadcast of packets.
 /// </summary>
 /// <param name="Composer"></param>
 public void WriteComposer(PacketComposer Composer)
 {
     foreach (RoomUnit Unit in GetUnits(UnitType.Player))
     {
         Unit.GetSession().WriteComposer(Composer);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Writes an buffer to the session.
        /// </summary>
        /// <param name="Composer"></param>
        public void WriteComposer(PacketComposer Composer)
        {
            if (Socket == null)
            {
                return;
            }

            try
            {
                var Buffer = Composer.GetOutput();
                var Result = default(SocketError);

                Socket.BeginSend(Buffer, 0, Buffer.Length, SocketFlags.None, out Result, new AsyncCallback(FinishSend), Socket);
            }
            catch (Exception e)
            {
                System.IOStreamer.AppendColor(ConsoleColor.Red);
                System.IOStreamer.AppendLine("[WriteComposer] {0}", e.Message);
            }
        }