Routing UDP data to the emulator

by Tim » Fri, 27 Mar 2009 01:11:59 GMT

Sponsored Links
 I've been scouring the forums and found similar issues like this, but
the solutions seems not to be working.

What we're doing is trying to receive data from an external server via
UDP. At the moment, doing a tcpdump on linux provides information that
yes, there is data coming into my computer. From here, however, things
become murky.

I have tried the following two tactics:

telnet localhost 5554

where 5000 is the port on my computer that is receiving data and 5000
is the port where Android is listening to. This achieves nothing.

The other tactic is the adb forward, which has the same results.

The UDP Server code is as follows:

public class Server extends Thread {
        private InetAddress serverAddr;
        private DatagramSocket socket;

        private static int port = 5000;
        private static final String tag = "UDP Server";

        public Server() {
                try {
                        this.serverAddr = InetAddress.getByName("");
                        this.socket = new DatagramSocket(port, this.serverAddr);
                        Log.d(tag, "listening port 5000");
                } catch (Exception e) {
                        Log.d(tag, "Failed accessing server address and 

        public void start() {

        public void run() {
                while(true) {
                        try {
                                byte[] buf = new byte[43];
                                /* Prepare a UDP-Packet that can
                                 * contain the data we want to receive */
                                DatagramPacket packet = new DatagramPacket(buf, 

                                this.socket.receive(packet);  // Receive the 
                                Log.d(tag, "Received: '" + new 
String(packet.getData()) + "'");
                        } catch (IOException e) {
                                Log.e(tag, "Error", e);

What this should do is listen to Android's network/ethernet interface
and output the recieved data (if there is any). What I get is nothing.
Android does not say that there is an error in Logcat or that anything
is received. This seems to tell me that the information is not being
redirected properly to the emulator.

Any thoughts on getting this redirection business settled?


Routing UDP data to the emulator

by David Turner » Fri, 27 Mar 2009 03:24:26 GMT

 Did you try listening to and/or ?


Sponsored Links

Routing UDP data to the emulator

by Tim » Sat, 28 Mar 2009 23:33:16 GMT

 I did a check using netstat and found that when I routed the udp
packet using
telnet localhost 5554

that the port that is listening to is

which does make things a bit better in terms of where its going to,
but the emulator
can't seem to make that last connection to it.

I'm going to try writing some code that will forward that data to and see
how the emulator reacts to that.

Any other solutions would be welcomed.

Other Threads

1. Transition from solid to transparent

Good day,
As the title suggests, I would like to know if there is any way to
make a transition from a solid drawable to a transparent one. It only
seems to work from the transparent one to the solid one and not vice-
versa... I need it for the background of a text cell, so any advice,
even without transition drawable, on how to obtain a similar effect
would be greatly appreciated.

Short story:
Basically I need to set the background of a text cell transparent
after awhile without timers... so any ideas are welcomed.



2. Can Android support Java J2SE(not only J2ME) as Linux and Unix?

 Good afternoon, everyone,
      Can Android support Java J2SE(not only J2ME) as Linux and Unix?
     Android developer's site of can not 
be accessed from Dalian, China. is there any other same Android kernel and platform
info website?
      Or can you tell me how to install Java J2SE program in Android?
      And does Android kernel support linux's wine program to run windows programs?
      I hope to receive your reply as soon as possible.
With best regards,
-------- Original Message --------
Subject: Re: [android-kernel] Re: Booting 2.6.39 kernel
From: Jon Pry <>
Date: Thu, May 12, 2011 10:32 pm

I am having the same problem. What stuff did you remove from the config?


Jon Pry

Ok, I solved the issue.

Now init starts-up!
The issue turned out to be related with the config file of the kernel.
I don't know why, after removing support for unrelated boards (among
which OMAP4 and other stuff) I was able to run the binaries.

Thanks guys, have a nice day!
" target=_blank>

3. Copy by Select Word di CM7

4. Android renders RGB values wrong.

5. My first android program


7. RALAT : WTS Philips Bluetooth Headset SHB 6110 Second Harga 350rb (nego)