예제 #1
0
        /// <summary>
        /// When a new message is received, the participant is added to the list of Participants.
        /// </summary>
        private async void MessageToConnectReceivedFromParticipantAsync(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
        {
            var participant = new UdpParticipantInformation {
                Host = args.RemoteAddress
            };

            // Read the subscriber's message.
            using (var reader = new StreamReader(args.GetDataStream().AsStreamForRead()))
            {
                string message = await reader.ReadLineAsync();

                // Add the participant.
                base.AddParticipant(participant, message);
            }
        }
        /// <summary>
        /// When a new message is received, the participant is added to the list of Participants.
        /// </summary>
        private async void MessageToConnectReceivedFromParticipantAsync(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
        {
            var participant = new UdpParticipantInformation { Host = args.RemoteAddress };

            // Read the subscriber's message.
            using (var reader = new StreamReader(args.GetDataStream().AsStreamForRead()))
            {
                string message = await reader.ReadLineAsync();
                
                // Add the participant.
                base.AddParticipant(participant, message);
            }
        }