Cant receive UDP packet correctly

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Cant receive UDP packet correctly

Postby Pierre » Mon Nov 16, 2009 3:08 am

My app use UDP, and communicate with my PC.
It can send and receive UDP packets.

Here my code (udp reception) :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. this.socket = new DatagramSocket(port);
  2.  
  3. byte[] array = new byte[500];
  4.  
  5. DatagramPacket packetIn = new DatagramPacket(array,500);
  6.  
  7. this.socket.receive(packetIn);
  8.  
  9. System.out.println("packet length " + packetIn.getLength());
  10.  
  11.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


My problem : received packets are ALWAYS truncated !
The displayed length is ALWAYS "1" !

When i "spy" packets from my computer (with Wireshark) , they're "normal" (not truncated).

2nd problem : the platform
This bug happens on :
- My HTC Hero (Android 1.5)
- Android emulator 1.5-1.6

I've no problem on Android emulator 2.0 !

http://www.anddev.org/udp_receive_problem-t6886.html
Same problem ?

Please help me, this bug makes me crazy !
Pierre
Freshman
Freshman
 
Posts: 5
Joined: Mon Nov 16, 2009 2:54 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 7 guests