Exemplo n.º 1
0
        private void DoWork(object state)
        {
            string messageText = $"Sending from Udp.TimedSender at {DateTimeOffset.Now}";

            logger.LogInformation($"Broadcasting message [{messageText}] to port {speaker.SpeakerConfig.BroadcastPort}");

            IUdpMessage message = UdpMessageFactory.CreateUdpMessage(messageText);

            IUdpTransportMessage response = speaker.BroadcastWithResponse(message, speaker.SpeakerConfig.BroadcastPort);

            logger.LogInformation($"Received response from {response.Address}:{response.Port}: [{response.Message.Text}]");
        }
Exemplo n.º 2
0
        public IActionResult OnPost()
        {
            logger.LogInformation($"Broadcasting message [{Message}] to port {speaker.SpeakerConfig.BroadcastPort}");

            IUdpMessage message = UdpMessageFactory.CreateUdpMessage(Message);

            IUdpTransportMessage response = speaker.BroadcastWithResponse(message, speaker.SpeakerConfig.BroadcastPort);

            Status = $"Received response from {response.Address}:{response.Port}: [{response.Message.Text}]";

            logger.LogInformation(Status);

            return(Page());
        }