Esempio 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);
            }
        }
Esempio 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);
         }
     }
 }
Esempio 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);
                }
            }
        }
Esempio 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");
        }
Esempio 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);
 }
 public void SendPDU(PDU pdu)
 {
     Channel channel = (Channel) channels[pdu.ChannelId];
     channel.Send(pdu.Buffer, pdu.Type);
 }
Esempio n. 7
0
 /**
  * Enqueue a PDU
  */
 public void addPDU(PDU pdu)
 {
     enqueue(pdu);
 }
Esempio n. 8
0
 /**
  * Enqueue a PDU
  */
 private void enqueue(PDU pdu)
 {
     wait();
     pduQ.AddLast(pdu);
     signal();
 }
Esempio n. 9
0
        public void SendPDU(PDU pdu)
        {
            Channel channel = (Channel)channels[pdu.ChannelId];

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