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("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?

--~--~---------~--~----~------------~-------~--~----~



Routing UDP data to the emulator

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


 Did you try listening to 0.0.0.0 and/or 10.0.2.2 ?





--~--~---------~--~----~------------~-------~--~----~


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
0.0.0.0:5000

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
0.0.0.0:5000 and see
how the emulator reacts to that.

Any other solutions would be welcomed.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. [WTA] Tentang Motorola Defy

Nubie mau selidik dikit tentang si-Defy

1. Dengan procy 800 apakah perfoma cukup menjanjikan untuk grafis ?
2. Native OS android versi apa ? Apakah sudah tersedia upgrade froyo ? Atau 
Ginger ? 
3. Asesoris sudah tersedia kah ?
4. Udah bisa root kah ?

Terimakaseh atas cerahannya...





make simple thing ! don't be afraid 

-- 
===============

2. [WTS]Aksesoris Otterbox,Zenus,SGP,Capdase for Galaxy S,Galaxy Tab,Nexus S & HTC (Desire HD etc)

alam Semua (numpang bandwidthnya ya)



Maaf nih menganggu lagi, sekarang mau update yg ready stock

Silahkannn

-HOT ITEMS
1. Otterbox Commuter Series for HTC Desire HD
2. Zenus Leather Case "Color Edge Series" for Galaxy Tab
3. Screen Guard SGP Ultra Series "Ultra Fine" for HTC Desire HD
(series terbaru dari anti finger print series)
4. Screen Guard SGP  Sheild 4.0 (only screen) for Nexus S

5. Capdase Softjacket Expose for HTC Desire HD

6. Capdase Softjackte Expose for Nexus S


++Samsung Galaxy S++
1.) Samsung Original Mesh Case/Punch Hole  (Anycall)+bonus standard
screen protector (lime green)
2.) Samsung Original Galaxy S Car Retail Stand
3.) Pouch Leather Case
4.) Universal Battery Charger for Galaxy S
5.) Samsung Original Battery Charger for Galaxy S


++Samsung Galaxy Tab++
1.) Docking (charger ama sync)
2.) Original Samsung Accessories Anycall Desktop Holder (made in Korea)
3.) No Brand Leather Standing Case (landscape)
4.) Screen Guard Anti Peeping (privacy=anti intip)

5.)Zenus Leather Case "Color Edge Series" for Galaxy Tab


++Nexus S++
1.) Silikon Case (black)

2.)Screen Guard SGP  Sheild 4.0 (only screen)

3.)Capdase Softjackte Expose


++HTC Desire HD++

1.)Otterbox Commuter Series

2.)Screen Guard SGP Ultra Series "Ultra Fine
(series terbaru dari anti finger print series)

3.)Capdase Softjacket Expose
4.) Mesh Case/Punch Hole (black,purple)
5.) Exclusive Docking (charger+sync) di balut premium leather warna merah
6.) Exclusive Pouch Leather Case with HTC logo (ada strapnya jadi
ngeluarinnya gampang and bawahnya ada ruang terbuka jadi dhdnya gak
cepat panas)
7.) Screen Guard Anti Peeping/Privacy (anti intip)
8.) Shiny Alumunium  Hardcase (black,red)
9.) Hard Back Case (black)
10.) Pouch Leather Case (black,dark brown)
11.) Silikon Case (black)
12.) Replacement battery for HTC Desire HD (Non OEM) 1600mA


++HTC Desire Z++
1.) Exclusive Pouch Leather Case with HTC logo (ada strapnya jadi
ngeluarinnya gampang and bawahnya ada ruang terbuka jadi dhdnya gak
cepat panas) (1pc)
2.) Replacement battery for HTC Desire Z  (non OEM)1600mA
3.) Carbon Fiber Flip Case
4.) Gel Case (tidak transparant tapi di buat dari TPU yg eco friendly)
(grey)
5.) Clear (crystal) Hard Case
6.) Silikon Case (black)


++HTC Google Nexus One++
 1.) Replacement battery for HTC Google Nexus One (non OEM)900mA


++HTC Desire++
 1.) Replacement battery for HTC Desire (non OEM)900mA
2.) Mesh Case/Punch Hole (black,pink,white)
3.) Clear (crystal) Hard Case
4.) Gel Case (tidak transparant tapi di buat dari TPU yg eco friendly)
(black)
5.) Silikon Case (black)


++HTC Wildfire++
1.) Mesh Case/Punch Hole (blue,pink)



++HTC HD7++
1.)Clear (crystal) Hard Case
2.) Mesh Case/Punch Hole (black
3.) Silikon Case (Black)
4.) Replacement battery for HTC HD7 (non OEM)1300mA


ps. untuk pic, silahkan lansung liat2 di www.moza-gadget.co.cc ato

http://www.kaskus.us/showthread.php?p=384427285#post384427285



Silahkannnn


Rizki Akbar
www.moza-gadget.co.cc
08121007550
rizki061...@gmail.com<http://id.mc770.mail.yahoo.com/mc/compose?to=rizki061...@gmail.com>
moza.gad...@gmail.com<http://id.mc770.mail.yahoo.com/mc/compose?to=moza.gad...@gmail.com>
kaskuser : aloly

-- 
===============

3. Boston, MA Android Developers

4. Portable application on SDcard

5. Charge backs

6. Intent.putExtra(String name,String value) method

7. OOT + WTI : Paket Internet Terbaru dari SmartFren