Did you try listening to 0.0.0.0 and/or 10.0.2.2 ?

On Wed, Mar 25, 2009 at 9:04 PM, Tim <[email protected]> wrote:

>
> 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
> >> redir add udp:5000:5000
>
> 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("10.0.2.15");
>                        this.socket = new DatagramSocket(port,
> this.serverAddr);
>                        Log.d(tag, "listening port 5000");
>                } catch (Exception e) {
>                        Log.d(tag, "Failed accessing server address and
> socket");
>                }
>        }
>
>        public void start() {
>                super.start();
>        }
>
>        public void run() {
>                Looper.prepare();
>                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, buf.length);
>
>                                this.socket.receive(packet);  // Receive the
> UDP-Packet
>                                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?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to