Beispiel #1
0
        private void ListenerMessageReceived(IUdpTransportMessage context)
        {
            string response = $"Received from {context.Address}:{context.Port}: {context.Message.Text}";

            logger.LogInformation(response);

            speaker.Send(UdpMessageFactory.CreateUdpMessage(response), context.Address, context.Port);
        }
Beispiel #2
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}]");
        }
Beispiel #3
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());
        }