public void TransmitLargeObject() { int expected_byte_count = 20000; byte[] raw_bytes = new byte[expected_byte_count]; Random rnd = new Random(); for (int i = 0; i < expected_byte_count; i++) { //raw_bytes[i] = (byte)rnd.Next(); raw_bytes[i] = (byte)'x'; } using (RelayController ctrl_send = RelayController.ConnectSerial("COM4")) { using (RelayController ctrl_rcv = RelayController.ConnectSerial("COM6")) { ctrl_send.Clear(); ulong long_address = 0x0013A20041B764AD; ushort short_address = ctrl_send.Discover(long_address); // receive "Discover" emission List <byte> rcv_bytes = ctrl_rcv.ReceiveBytes(); Assert.AreEqual("Discover".Length, rcv_bytes.Count); // send actual data try { ctrl_send.Transmit(short_address, raw_bytes); } catch { // ignored Console.WriteLine("Transmission failed"); } List <EmissionDescriptor> emissions = ctrl_send.GetAllEmissions(); foreach (EmissionDescriptor descriptor in emissions) { Console.WriteLine($"Unused emission with frame type {descriptor.Header.FrameType}"); } // receive actual data byte[] rcv_data_bytes = ctrl_rcv.ReceiveTransmission(0); Assert.AreEqual(expected_byte_count, rcv_data_bytes.Length); for (int i = 0; i < expected_byte_count; i++) { Assert.AreEqual(raw_bytes[i], rcv_data_bytes[i]); } } } }