public void IteratorTest() { int count = 0; byte[] buffer_A = new byte[16]; byte[] buffer_B = new byte[32]; byte[] buffer_C = new byte[64]; byte[][] buffers = new byte[3][]; buffers[0] = buffer_A; buffers[1] = buffer_B; buffers[2] = buffer_C; for (int i = 0; i < buffer_A.Length; i++) buffer_A[i] = 0xAA; for (int i = 0; i < buffer_B.Length; i++) buffer_B[i] = 0xBB; for (int i = 0; i < buffer_C.Length; i++) buffer_C[i] = 0xCC; string filename = "data/test.pcap"; PcapReader pcap = new PcapReader(filename); foreach (PcapRecord record in pcap) { //Assert.Equals(record.Buffer, buffers[count]); count++; } Assert.AreEqual(count, 3); }
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); } }
public void IteratorTest() { int count = 0; byte[] buffer_A = new byte[16]; byte[] buffer_B = new byte[32]; byte[] buffer_C = new byte[64]; byte[][] buffers = new byte[3][]; buffers[0] = buffer_A; buffers[1] = buffer_B; buffers[2] = buffer_C; for (int i = 0; i < buffer_A.Length; i++) { buffer_A[i] = 0xAA; } for (int i = 0; i < buffer_B.Length; i++) { buffer_B[i] = 0xBB; } for (int i = 0; i < buffer_C.Length; i++) { buffer_C[i] = 0xCC; } string filename = "data/test.pcap"; PcapReader pcap = new PcapReader(filename); foreach (PcapRecord record in pcap) { //Assert.Equals(record.Buffer, buffers[count]); count++; } Assert.AreEqual(count, 3); }