示例#1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting up piled server");

            var matrix = RgbMatrixFactory.Create();

            using (UdpClient listener = new UdpClient(ListenPort))
            {
                IPEndPoint groupEndpoint = new IPEndPoint(IPAddress.Any, ListenPort);

                try
                {
                    while (true)
                    {
                        byte[] bytes = listener.Receive(ref groupEndpoint);
                        Console.WriteLine($"Received {bytes.Length} bytes from {groupEndpoint}");
                        matrix.SetCanvas(RgbCanvas.FromBytes(matrix.Width, matrix.Height, bytes));
                    }
                }
                catch (SocketException ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
示例#2
0
 public void Render(RgbCanvas rgbCanvas)
 {
     _piConnection.SendBytes(rgbCanvas.ToBytes());
 }