Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            WorkingDirectory = Directory.GetCurrentDirectory();

            if (!WorkingDirectory.EndsWith("/"))
                WorkingDirectory += "/";

            if ((args.Length > 1) && (args[0].Equals("--replay")))
            {
                replayFile = args[1].ToString();
                Console.WriteLine("Replay Mode, using {0}", replayFile);
                replayMode = true;
            }

            Broadcaster server = new Broadcaster("127.0.0.1", 4489);

            System.Threading.Thread.Sleep(50000);
            Console.WriteLine("50 sec passed");

            if (replayMode)
            {
                PcapReader pcap = new PcapReader(File.OpenRead(replayFile));

                foreach (PcapRecord record in pcap)
                {
                    PDU pdu = new PDU(record.Buffer, 0, 1);
                    server.addPDU(pdu, "ABCDEF123456".ToCharArray());
                }
            }

            while (true)
            {
                Thread.Sleep(10);
            }
        }
Ejemplo n.º 2
0
 public void ChannelThreadProc()
 {
     while (true)
     {
         lock (channelLock)
         {
             Monitor.Wait(channelLock);
             PDU pdu = (PDU)queue.Dequeue();
             ProcessPDU(pdu.Buffer, pdu.Type);
             Monitor.Pulse(channelLock);
         }
     }
 }
Ejemplo n.º 3
0
        /**
         * Code executed by the thread. Listening and processing received packets
         **/
        public void ChannelThreadProc()
        {
            while (!stopthread)
            {
                lock (channelLock)
                {
                    while (queue.Count < 1 && !stopthread)
                    {
                        Monitor.Wait(channelLock);
                    }

                    if (queue.Count >= 1)
                    {
                        PDU pdu = (PDU)queue.Dequeue();
                        ProcessPDU(pdu.Buffer, pdu.Type);
                    }

                    Monitor.Pulse(channelLock);
                }
            }
        }
Ejemplo n.º 4
0
        /**
         * Code executed by the thread. Listening and processing received packets
         **/
        public void ChannelThreadProc()
        {
            while (!stopthread)
            {
                lock (channelLock)
                {
                    while (queue.Count < 1 && !stopthread)
                    {
                        Monitor.Wait(channelLock);
                    }

                    if (queue.Count >= 1)
                    {
                        PDU pdu = (PDU)queue.Dequeue();
                        ProcessPDU(pdu.Buffer, pdu.Type);
                    }

                    Monitor.Pulse(channelLock);
                }
            }

            Console.WriteLine("InputClient.ChannelThreadProc end");
        }
Ejemplo n.º 5
0
 /**
  * Add PDU to clients belonging to a given session
  *
  * @param pdu
  */
 public void addPDU(PDU pdu, char[] sessionKey)
 {
     ScreenSessions.Instance.addPDU(pdu, sessionKey);
 }
Ejemplo n.º 6
0
 public void SendPDU(PDU pdu)
 {
     Channel channel = (Channel) channels[pdu.ChannelId];
     channel.Send(pdu.Buffer, pdu.Type);
 }
Ejemplo n.º 7
0
 /**
  * Enqueue a PDU
  */
 public void addPDU(PDU pdu)
 {
     enqueue(pdu);
 }
Ejemplo n.º 8
0
 /**
  * Enqueue a PDU
  */
 private void enqueue(PDU pdu)
 {
     wait();
     pduQ.AddLast(pdu);
     signal();
 }
Ejemplo n.º 9
0
        public void SendPDU(PDU pdu)
        {
            Channel channel = (Channel)channels[pdu.ChannelId];

            channel.Send(pdu.Buffer, pdu.Type);
        }