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. Feature request / Defect report declined with no comment

I just posted a defect / feature request and it was declined without
comment. Can anybody explain to me why this was declined without an

I took the time to provide feedback as a user of the android api,
based on some discussion in the developer group. I am not the only
developer who has encountered this deficiency in the api. I think I
explained the deficiency clearly. And I think it is a professional
courtesy to provide an explanation. If it is a duplicate, please say
so. If I am in error and this is not a problem because of an oversight
on my part, I think that would be helpful to know.

If the attitude of the project owners is that the api is good enough.
Maybe we could have a short conversation about that.

As it stands now, I have no insight into this issue or why my defect
was declined. Was it rejected for good reason or an arrogant developer
who like to hit the reject button?


2. Search context with type-to-search?

When implementing search in my application, I'm including some search
context info depending on the activity where search is invoked.  In
one of those, I'd like to implement type-to-search as well, but the
standard method of adding search context info doesn't work in that
case... the onSearchRequested() method in the activity is never

Is there any way to include search context info in a type-to-search
invocation, or am I stuck with only the Search key and menu option?

3. HTC magic static ip not working

4. EAP Tunneled TLS (TTLS) Authentication Protocol for Android?

5. Android and Data Call

6. Integrating libupnp to Android

7. Widget home screen position