1. Are you ready for the Galaxy S20? Here is everything we know so far!

Multicast Receive

Discussion in 'Android Development' started by jasleen, Sep 22, 2011.

  1. jasleen

    jasleen Lurker
    Thread Starter

    I have been writing a RTSP streaming app in eclipse for android.
    Its a RTSP Streaming client.

    I am able to do the handshaking i.e am able to receive responses for DESCRIBE, SETUP, PLAY commands.

    I am receiving the data in multicast mode.

    The problem is that I am unable to receive the data(video) packets thereafter.

    Following is the code i have used to receive multicast data

    wifi = (WifiManager) getSystemService(getApplicationContext().WIFI_SERVICE);

    mLock = wifi.createMulticastLock("mylock");
    mLock.setReferenceCounted(true);
    mLock.acquire();

    MulticastSocket sock;
    InetAddress sessAddr = netAddress.getByName("234.2.128.12");
    sock = new MulticastSocket(1100);//48180);

    byte b = 64;
    sock.setTTL(b);
    sock.joinGroup(sessAddr);


    byte[] byData = new byte[500];
    DatagramPacket pack = new DatagramPacket(byData, 500);

    sock.receive(pack);

    The code hangs at receive call.
    Plus there are following tags in manifest xml

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />



    Please suggest.
     


Loading...

Share This Page

Loading...