Exemple #1
0
        public void Write(CastMessage message, DeviceState state)
        {
            if (Disposed)
            {
                return;
            }

            logger.Log($"out [{DateTime.Now.ToLongTimeString()}] [{state}] [{ipAddress}:{port}] {message.PayloadUtf8}");
            var byteArray = ChromeCastMessages.MessageToByteArray(message);

            sslStream.BeginWrite(byteArray, 0, byteArray.Length, WriteAsyncCallback, sslStream);
        }
 public async Task SendMessageAsync(CastMessage castMessage)
 {
     var byteMessage = ChromeCastMessages.MessageToByteArray(castMessage);
     await connection.SendMessageAsync(new ArraySegment <byte>(byteMessage));
 }