S
Sebastian Staudt
Hello.
I'm trying to read packets from a DatagramChannel and only get non-
zero data of a packet. Zeros at the end of the packet are discarded.
Doing the same with the channel's DatagramSocket.receive(), I get the
whole packet data.
For example there's a 20 byte long packet arriving which consists of
10 bytes random data and 10 zeros. With the channel I only get the
first 10 bytes. The socket gives me the whole 20 bytes.
Did I miss something or is this a bug in DatagramChannel.read() or
even wanted behavior?
PS: I'm using this with Java 1.5.
I'm trying to read packets from a DatagramChannel and only get non-
zero data of a packet. Zeros at the end of the packet are discarded.
Doing the same with the channel's DatagramSocket.receive(), I get the
whole packet data.
For example there's a 20 byte long packet arriving which consists of
10 bytes random data and 10 zeros. With the channel I only get the
first 10 bytes. The socket gives me the whole 20 bytes.
Did I miss something or is this a bug in DatagramChannel.read() or
even wanted behavior?
PS: I'm using this with Java 1.5.