Multicast problem

by Thiago B. » Fri, 10 Apr 2009 01:48:53 GMT

Sponsored Links
 Hi, I'm trying to develop an application that need to send UDP
Multicast packets to the local network.
There is a few equipments that respond to this packets and send back
some informations.
I'm not worried with the server right now, because there is a server
on the same network that collect all this multicast data.
I just want to make my mobile able to send the request message to
start the process.

My client class is called MCastClient, see below:

public class MCastClient {
        private int port = 50000;
        private String addr = "";
        private MulticastSocket sock = null;

        public void sendData(String data) {
                try {
                        InetAddress group = InetAddress.getByName(addr);

                        sock = new MulticastSocket(port);


                        DatagramPacket dataPckt = new 
                                        data.length(), group, port);

                } catch (Exception e) {}

It runs perfectly on my computer as a Java Application.

On the Android Emulator i create a simple application with a button
and add a OnClickListener.

public void onCreate(Bundle savedInstanceState) {

    final MCastClient mcClient = new MCastClient();
    Button btn = (Button)findViewById(;

    btn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {

I believe that my packet is not arriving on the local network.
I already did some test with the command "redir add udp:50000:50000"
on telnet port of the emulator, that i got from #connecting.

There is any other command that can forward ports to the emulator?
I'm almost putting a port sniffer on my machine just to check what is

Thanks for the help, it will be very appreciated.
Thiago B.


Multicast problem

by David Turner » Fri, 10 Apr 2009 19:14:35 GMT

 Sorry, but the emulator currently doesn't support multicast :-(


Sponsored Links

Other Threads

1. Creating ImageView on the fly

I have a problem. I want to have several dynamicaly created
e.g. a cricle with some specific text in it (the text is created
before, by the app and can't be predicted) ( That is the problem, as I
figured out I cannot write on a bmp or drawable)
I may have several of those circles, so that I need to scroll on the
display and additionally I want to 'click' on any of those circles (I
dont to have buttons) and know on what I clicked. (some sort of

I tried with a Canvas where I put those circles and text in, which
looks realy nice, but I can't scroll there...... (maybe getting the
scroll to work here would be helpful as well)

Anyone has another idea?

Thanks a lot


2. Browser: Keyboard disappears.

Hi Androidians,

         This is a magic happening with browser. When i touch the URL
field  in the browser, a fake tittle bar comes up and it is a so
called search dialog, and start typing some letters fast, the keyboard
disappears. And the Log events* say the following. Once it is
happened, especially in land scape, the edit text field (Integrated
with keyboard itself), does not reflects the letters typed afterwards,
but gets reflected in the fake tittle bar behind it. I am not able
categorize where and how its happening. Could anybody help me.

Thank you,
With Regards

Log Events: / ********************/

D/dalvikvm( 3742): GC freed 6726 objects / 252560 bytes in 86ms
E/SurfaceFlinger( 2061): createSurface() failed, generateId = -12
W/WindowManager( 2061): OutOfResourcesException creating surface
I/WindowManager( 2061): Out of memory for surface!  Looking for
W/WindowManager( 2061): No leaked surfaces; killing applicatons!
W/ActivityManager( 2061): Killing processes for memory at adjustment 1
W/ActivityManager( 2061): Killing for memory: ProcessRecord{47fb9be8} (adj 1)
I/Process ( 2061): Sending signal. PID: 2142 SIG: 9
W/WindowManager( 2061): Looks like we have reclaimed some memory,
clearing surface for retry.
W/WindowManager( 2061): Due to memory failure, waiting a bit for next
I/ActivityManager( 2061): Process (pid
2142) has died.
W/ActivityManager( 2061): Scheduling restart of crashed service in 5000ms
I/WindowManager( 2061): WIN DEATH: Window{480d1bf8 InputMethod
I/WindowManager( 2061): WIN DEATH: Window{48138248 PopupWindow:
47e21b10 paused=false}
E/ActivityThread( 2061): Failed to find provider info for
W/Checkin ( 2061): Can't log event SYSTEM_SERVICE_LOOPING:
java.lang.IllegalArgumentException: Unknown URL 
I/ActivityManager( 2061): Start proc for
service pid=4285 uid=10015
gids={3003, 1015}
D/ddm-heap( 4285): Got feature list request
D/dalvikvm( 4285): Trying to load lib /system/lib/
D/dalvikvm( 4285): Added shared lib /system/lib/
W/InputMethodManager( 2061): Ignoring onBind: cur seq=18, given seq=38
D/dalvikvm( 4285): GC freed 1235 objects / 88664 bytes in 45ms


3. How to access Phone Book

4. install android hello alert into BlackBerry Mobile

5. MediaPlayer RTSP Timeout

6. Call prerecorded message

7. Northern Sami - bug in Market language detection?