This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Bug in libgcj UDP network classes
- From: Michael Koch <konqueror at gmx dot de>
- To: Norbert Frese <postfach at nfrese dot net>
- Cc: java at gcc dot gnu dot org
- Date: Thu, 20 Nov 2003 21:36:54 +0100
- Subject: Re: Bug in libgcj UDP network classes
- References: <1069360450.3358.137.camel@lilota.lamp.priv>
On Thu, Nov 20, 2003 at 09:34:10PM +0100, Norbert Frese wrote:
> Hi list!
>
> I have found a bug in the libgcj network-classes:
>
> It seems that the length of data of an incoming UDP packet gets
> overwritten by other UDP packets queueing up on the same socket.
> -> When you call DatagramSocket.receive() the wrong number of bytes is
> copied to the byte[] buffer.
>
> I have written a little test-program 'UDPTest', which sends two packets
> in an endless loop to itself:
>
> packet1 contains the String: "Hello World 1234567890 ++++++++++++++"
> packet2 contains the String: "World Hello 0987654321"
>
> UDPTest output gcj (3.4 from CVS, checked out today):
>
> $ ./udptest_gcj
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 length=22
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 length=22
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 length=22
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 length=22
> got packet:World Hello 0987654321 length=22
>
> UDPTest output sun jre:
>
> $ java UDPTest
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
> got packet:Hello World 1234567890 ++++++++++++++ length=37
> got packet:World Hello 0987654321 length=22
>
> Attached is the source of UDPTest.
I'm looking into it as I'm currently at that code anyway.
Thx for testing and reporting.
Michael