In-bound datagrams are not received in the code below. When I comment
out the call to DatagramSocket.connect() and specify the server+port
in the DatagramPacket  constructor it works fine.

                    // connect to echo server at _hostName and _port
                     InetAddress serverAddr =
InetAddress.getByName(_hostName);
                    DatagramSocket socket = new DatagramSocket();
                    socket.setSoTimeout( 5000 );

                   // this causes socket.receive to timeout
                   socket.connect(serverAddr,_port);

                   byte[] buffer = ("Hello from Client").getBytes();

                    DatagramPacket packet = new
DatagramPacket(buffer,buffer.length);

                    socket.send( packet );
                    Date timeSent = new Date();
                    Logger.getLogger().info("sent packet at 
"+timeSent.toString());
                    socket.receive( packet );
                    Date timeReceived = new Date();
                    Logger.getLogger().info("received packet at
"+timeReceived.toString());

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to