Come to think of it, I should have been able to figure out that answer
from your previous posts. But it does still suggest an interesting
test: does this failure occur ONLY when using WiFi? That is, if you
both access the HTTP server and receive UDP over the carrier's data
connection, does it work just fine? That would help isolate the
problem specifically to the WiFi.
The phone is supposed to be able to handle both at once, no matter
whether you are using WiFi or carrier data. It shouldn't matter
whether or not the WiFi is encrypted either, but that might be worth a
try, too. That is, if you have been testing with an encrypted
connection, try it with an unencrypted one.
For my G2, I did code that was basically like:
try {
DatagramSocket s = new DatagramSocket(port); // socket that
receives client msg
byte[] buffer = new byte[4096]; // buffer to
hold
data
DatagramPacket p =
new DatagramPacket(buffer, buffer.length); // the packet
that
receives it
s.receive(p); // WAIT For a
packet to arrive
System.out.println("Got packet from remote system");
String msg = // convert the
bytes from the
new String(buffer, 0, p.getLength()); // packet back
to a
string.
System.out.println("packet databuf has string: " + msg);
s.close(); // always close
}
catch (SocketException e) {
System.out.println("Got SocketException" + e);
} // thrown by new DatagramSocket()
catch (java.io.IOException e) {
System.out.println("Got IOException on socket");
} // thrown by DatagramSocket.receive();
(except w/ Log.d instead of println) and it just worked. I never had
the problem you report. What are you doing different?
On Aug 4, 2:52 pm, Heidi Zhou Nolan <[email protected]>
wrote:
> It is HTC Desire Z A7272.
>
> All the phones are using WiFi connection. The connection is good.
>
> Thank you again.
>
> On Aug 4, 2:59 am, Indicator Veritatis <[email protected]> wrote:
>
>
>
>
>
>
>
> > Then it is device specific, though it affects a surprisingly high
> > number of devices. And are you sure you see it on the HTC Desire? That
> > is very similar to my G2, which also goes under the name of "Desire
> > Z". And as I already mentioned, I never saw any such problem on my G2.
> > Are you using the same network setup when you do these tests on all
> > these different phones? That is, do you stick to using the WiFi
> > connection or the carrier network, or did you do some with carrier,
> > some with WiFi data connection?
>
> > On Aug 3, 2:21 am, Heidi Zhou Nolan <[email protected]>
> > wrote:
>
> > > Thank you for the reply.
>
> > > so is it a device specific bug?
>
> > > I can reproduce this problem on many kinds Android phones, like HTC
> > > NextusOne, HTC Desire Z, HTC Legend. However, I don't have such
> > > problem with HTC Sensation and Samsang.
>
> > > I did a roughly search and didn't see any report on the similar
> > > problem as this.
>
> > > On Jul 28, 11:19 am, Indicator Veritatis <[email protected]> wrote:
>
> > > > Have any relevant network bugs been reported for the device you are
> > > > using? I have never seen such a failure on my G2.
>
> > > > On Jul 27, 12:19 am, Heidi Zhou Nolan <[email protected]>
> > > > wrote:
>
> > > > > Yes, the application can receive the data well when the browser is not
> > > > > running.
>
> > > > > I wonder if I have to use native code for this. Now, I am using Java's
> > > > >DatagramSocketclass.
>
> > > > > On Jul 26, 10:11 pm, Indicator Veritatis <[email protected]> wrote:
>
> > > > > > Does your UDP receive code work fine if the browser is not running?
>
> > > > > > On Jul 26, 4:52 am, Heidi Zhou Nolan <[email protected]>
> > > > > > wrote:
>
> > > > > > > I am implementing a UDP application on Android.
>
> > > > > > > The problem I have is that, on the sender side of the UDP
> > > > > > > connection,
> > > > > > > the sender sends around 2 packets every 40 milliseconds; the
> > > > > > > receiver
> > > > > > > side of the UDP connection uses
> > > > > > > java.net.DatagramSocket.receive(...)
> > > > > > > function to receive data over the network in a while loop. The
> > > > > > > receiver receives 2 packets roughly every 40 milliseconds. While
> > > > > > > our
> > > > > > > Android application is running, the internet browser is launched
> > > > > > > and
> > > > > > > start downloading/retrieving webpage. The receive(...) function
> > > > > > > won't
> > > > > > > return any data until the browser stop its downloading. I did a
> > > > > > > measurement that the receive(...) function returns data after
> > > > > > > almost
> > > > > > > 700 milliseconds. It seems that all the packets to our
> > > > > > > application are
> > > > > > > hold until the browser is done with its network activity.
>
> > > > > > > I am looking for the solution to still receive data over the
> > > > > > > network
> > > > > > > even there is other application sends or receive data over
> > > > > > > network at
> > > > > > > the same time. It would be better if the solution can make our
> > > > > > > application have higher priority in using the network.
>
> > > > > > > Thank you in advance for your help.
--
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