I am seeing this same issue.  Have you found a solution?

On May 6, 2:01 am, "marcomoel...@googlemail.com"
<marcomoel...@googlemail.com> wrote:
> Hi,
>
> I have written an app what is receiving UDP broadcast messages (via
> WLAN). It is running on an HTC magic (1.6) without any problems. But
> on a HTC Desire (2.1.1) or Motorola Milestone (2.0.1) we receive
> nothing.
> We tryed to send the broadcast by the phone it self, this is working
> on all phones...
>
> Has anyone a clue what could be wrong?
>
> Thx
>
> Marco
>
> here my code:
> ---
> DatagramSocket dsocket;
>                                         try {
>                                                 dsocket = new 
> DatagramSocket(BROADCAST_PORT);
>                                                 dsocket.setReuseAddress(true);
>                                         } catch (SocketException e) {
>                                                 
> CDebug.getLog().log(Level.SEVERE,
>                                                                 "Could not 
> open Backend broadcast listener", e);
>                                                 return;
>                                         }
>
>                                         // Create a buffer to read datagrams 
> into. If a
>                                         // packet is larger than this buffer, 
> the
>                                         // excess will simply be discarded!
>                                         byte[] buffer = new byte[2048];
>
>                                         // Create a packet to receive data 
> into the buffer
>                                         DatagramPacket packet = new 
> DatagramPacket(buffer,
>                                                         buffer.length);
>
>                                         CDebug.getLog().log(Level.FINE,
>                                                         "Open Backend 
> broadcast listener on Port: " + BROADCAST_PORT);
>                                         dsocket.setSoTimeout(300); // max 
> time the socket is blocked
>                                         // System.out.println("open poard");
>                                         // Now loop forever, waiting to 
> receive packets and printing
>                                         // them.
>                                         while (true) {
>                                                 if (stopBroadcastListening) {
>                                                         dsocket.close();
>                                                         return;
>                                                 }
>                                                 // Wait to receive a datagram
>                                                 try {
>
>                                                         
> dsocket.receive(packet);
>                                                         oneBroadcastReceived 
> = true;
>                                                 } catch 
> (SocketTimeoutException e) {
> //                                                      Debug
> //                                                      
> .getLog().info("Backend broadcast listener timeout");
>                                                         continue;
>                                                 } catch (IOException e) {
>                                                         CDebug
>                                                                         
> .getLog()
>                                                                         .log(
>                                                                               
>           Level.SEVERE,
>                                                                               
>           "Could not read from Backend broadcast listener socket.
> close connection",
>                                                                               
>           e);
>                                                         dsocket.close();
>                                                         return;
>                                                 }
>
>                                                 // Convert the contents to a 
> string, and display them
>                                                 String msg = new 
> String(buffer, 0, packet.getLength());
>                                                 InetSocketAddress sender = 
> (InetSocketAddress) packet
>                                                                 
> .getSocketAddress();
> //                                              System.out.println(sender + 
> msg);
>                                                 CDebug.getLog().log(
>                                                                 Level.INFO,
>                                                                 "Receive 
> Broadcast from "
>                                                                               
>   + sender.getHostName() + ":" + msg);
>
>                                                 try {
>                                                         
> ObjectParser.fireEventsForMessage(msg, me,sender);
>                                                 } catch (Exception e) {
>                                                         CDebug.getLog().log(
>                                                                         
> Level.WARNING,
>                                                                         
> "Could not compute received message from Backend broadcast:"
>                                                                               
>           + msg, e);
>                                                 }
>
>                                                 // 
> System.out.println(packet.getAddress().getHostName()
>                                                 // +
>                                                 // ": " + msg);
>
>                                                 // Reset the length of the 
> packet before reusing it.
>                                                 
> packet.setLength(buffer.length);
>                                         }
>                                 } catch (Throwable t) {
>                                         
> CAirport.getInstance().unsetBroadcastListening();
>                                 }
>                         }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to