public bool Send(TcpClient client, FrameStream frame)
#endif
        {
            if (client == null)
            {
                return(false);
            }

            // Make sure that we don't have any race conditions with writing to the same client
            lock (client)
            {
                try
                {
                    // Get the raw bytes from the frame and send them
                    byte[] data = frame.GetData();

                    RawWrite(client, data);
                    return(true);
                }
                catch
                {
                    // The client is no longer connected or is unresponsive
                }
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// The direct byte send method to the specified client
        /// </summary>
        /// <param name="client">The target client that will receive the frame</param>
        /// <param name="frame">The frame that is to be sent to the specified client</param>
        public override void Send(FrameStream frame)
        {
            // Get the raw bytes from the frame and send them
            byte[] data = frame.GetData();

            ForgeWrite(data, data.Length);
        }
Esempio n. 3
0
 /// <summary>
 /// The direct byte send method to the specified client
 /// </summary>
 /// <param name="client">The target client that will receive the frame</param>
 /// <param name="frame">The frame that is to be sent to the specified client</param>
 public virtual void Send(FrameStream frame)
 {
     // Make sure that we don't have any race conditions with writing to the same client
     lock (client) {
         // Get the raw bytes from the frame and send them
         byte[] data = frame.GetData();
         RawWrite(data);
     }
 }