Sending Packets via UDP over a WIFI connection

by Joshua Nelson » Fri, 12 Mar 2010 01:46:43 GMT

Sponsored Links
 Hi All,

I am trying to send UDP packets over a WIFI connection from my phone
to a Server on my pc. Here is the code that I have on my client:

 String data = "Testing";
 byte [] buffer = data.getBytes();

 DatagramPacket packet = new DatagramPacket(buffer, buffer.length,
                new InetSocketAddress(ipaddress, port));

 DatagramSocket socket = new DatagramSocket(5003);

I have tried this code in a Java app sending from my laptop to my
desktop and it works fine. I am assuming its because I am not setting
up the WIFI connection properly that it is not working on my phone.
Any ideas?


Other Threads

1. Application works after reboot the phone

hi guys,

i have found out a strange behavior. My application works only after
phone reboots. after rebooting the phone first time application works
fine. from there onwards it's not working.

any ideas??



2. Storing data on the SD card in Froyo - files deleted when upgrading

Sorry yes this is indeed a bug in Froyo. :(

I have patch to fix this now in the Froyo tree:

I can't tell you when it will appear on various devices, but hopefully we
can get it rolled out fairly quickly.  (Note -- do expect to see devices
updating to Froyo for a while without this patch, since there is a fairly
long natural lag between code going in and builds being created with it and
going through TA to be delivered to devices.)

> > > > 

3. bindService() does not create local service, but returns true

4. Windows unable to recognize the HTC evo device

5. Possible to gather application logs at runtime?

6. Unable to retrieve the GIVEN_NAME or FAMILY_NAME from database

7. Big Issue with running and testing app on phone while still being connected to PC