public UdpSocketMulticastClientPage()
        {
            _client = new UdpSocketMulticastClient();
            _messagesSub = new Subject<Message>();
            _messagesObs = _messagesSub.AsObservable();

            InitView();
        }
Exemple #2
0
        public Server()
        {
            this.IsMulticastConnected = false;
            this._receiver = new UdpSocketMulticastClient();
            this._receiver.MessageReceived += MessageReceived;
            this._listener = new TcpSocketListener();
            this._listener.ConnectionReceived += ListenerConnectionReceived;
            IsMulticastConnected = JoinMultiUdp();

            if (!IsMulticastConnected)
            {
                var msg = new Message(MessageTypes.NetworkWarning, "Cannot connect to multicast UDP.");
                MessageManager.SendMessage(msg);
            }
        }
        public async void Connect()
        {
            try
            {
                foreach (IPAddress localIp in IpV4Addresses)
                {
                    var client = new UdpSocketMulticastClient(); //UdpClient(new IPEndPoint(localIp, _localEndpoint.Port));
                    UdpClients.Add(client);
                    client.MessageReceived += OnMessageReceived;
                    await client.JoinMulticastGroupAsync(RemoteEndPoint.Address.ToString(), RemoteEndPoint.Port); //.JoinMulticastGroup(ConnectionConfiguration.IpAddress, localIp);
                }
            }
            catch (SocketException ex)
            {
                if (IsDebug)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }

            base.Connected();
        }