0
            _udpAddr = IPAddress.Parse("228.5.6.9");
            var port = 3333;

            IPAddress localAddr = IPAddress.Any;
            // Create endpoints
            _remoteEndPoint = new IPEndPoint(_udpAddr, port);
            _localEndPoint = new IPEndPoint(localAddr, port);

            // Create and configure and bind UdpClient
            _udpclient = new UdpClient(_localEndPoint);

            // Join
            _udpclient.JoinMulticastGroup(_udpAddr, localAddr);

            // Start listening for incoming data
            _udpclient.BeginReceive(new AsyncCallback(ReceivedCallback), null);

This is my UDP Multicast join code.

This code works fine on Xamarin UWP App and WIFI Connect only Android devices.

But, when Android devices connected to WIFI and LTE, device can't receive & send anything.

So, I changed LocalEndPoint setting like this,

    ...
    ....
    //IPAddress localAddr = IPAddress.Any;
    IPAddress localAddr = IPAddress.Parse(GetLocalIPAddress());
    ....
    ..

    public static string GetLocalIPAddress()
    {
        var host = Dns.GetHostEntry(Dns.GetHostName());
        foreach (var ip in host.AddressList)
        {
            if (ip.AddressFamily == AddressFamily.InterNetwork
                && ip.ToString().Contains("192.168."))
            {
                return ip.ToString();
            }
        }
        throw new Exception("Local IP Address Not Found!");
    }

With this code, every Android device send works fine, but receive nothing.

The interesting thing is the both code works fine on UWP App.

UWP App can send & receive using any LocalEndpoint.

How Can Multicast join on Android devices connected to WIFI and LTE?

1 Answer 1

0

LTE doesn't support Multicast, only MMBS, which is a 3GPP variant of Multicast accessible by operators.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes that's correct. Obviously, I'm using multicast in WiFi internal network. The question is why multicast receive not work in Android devices connected to WiFi and LTE. I think multicast join is success. Because send packet is arrived other multicast join devices. But can't receive anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.