Sorry if this wasn't the appropriate place to put it, but I haven't been able to find the answer anywhere, but you did just solved my problem... Thank you for that ;)
On 25 feb, 19:32, Indicator Veritatis <[email protected]> wrote: > This is a Java question, not an Android one. Look for sample code > using java.net.DatagramPacket and DatagramSocket. Instead of trimming, > you are much more likely to write something like: > > DatagramPacket p = new DatagramPacket(packetBytes, packetBytes.length, > sa); > socket.receive(p); > bytesRead = p.getLength(); // this is actual bytes read > > On Feb 24, 2:53 am, ThaMe90 <[email protected]> wrote: > > > Is it possible to not set a DatagramPacket's buffersize? I want to use > > this DatagramPacket in the receive method of my DatagramSocket, but I > > don't know how large the buffersize should be as the data I receive is > > unknown. > > > If this is possible, please enlighten me. If not, could anybody show > > me a way to trim the buffer to size when it is filled up with 0's? > > (E.g. when I set the buffer size to 2048 & the packet I receive has a > > data size of 1800, the buffer will be filled with 0's till it is at > > 2048 length) So how could I achieve this? -- 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

