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);
 socket.send(packet);

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. Adding new contacts from an application

Hi,

I am writing an application from which I need to update and write new
contacts to Contact database.

what would be the best way to do this?
i have read several posts in which people have tried doing this but
could not not succeed, so has anybody successfully done this?

thanks,
kartic
--~--~---------~--~----~------------~-------~--~----~

2. Adding record to Content Provider

I was running the code shown at 
http://code.google.com/android/devel/data/contentproviders.html
in the "Adding Records" section.

As shown in the code, the added contact is STARRED to add to
favorites.
values.put(Contacts.People.STARRED,1);

For some reason, if I changed the value to 0 (don't add to favorites),
it doesn't show up on the Contacts list.

Has anyone seen this before or know what is going on here?

Using android-sdk-windows-1.0_r1

Thanks,
bvdev

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

3. android security software/malware softwar

4. CHROOT problem

5. changing string resources

6. surfaceflinger different layers

7. Border around a LinearLayout / rounded edges