Example #1
0
 public void Push(Event e)
 {
     waitedEvent.Push(e);
 }
Example #2
0
        /// <summary>
        /// Send event to the associate client.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="evt"></param>
        private void SendEvent(IVrpnObject sender, Event evt)
        {
            stream = new MemoryStream();
            formatter.Serialize(stream, evt);
            sendBuffer = stream.GetBuffer();
            Socket conveyor = this.remotes[sender].Socket;

            try
            {
                // Begin sending the data to the remote device.
                conveyor.BeginSend(sendBuffer, 0, sendBuffer.Length, 0, new AsyncCallback(SendCallback), conveyor);
            }
            catch (SocketException se)
            {
                Console.WriteLine("Sending error " + se.SocketErrorCode + "(" + se.ErrorCode + ") : " + se.Message + " on " + evt.Device);
                //Quit only if socket is disconnected.
                if (!conveyor.Connected)
                {
                    Console.WriteLine("Client connection error. He maybe quits.");
                    this.RemoveClient(sender);
                }
            } catch (Exception e)  {
                Console.WriteLine(e.ToString());
             }
        }