This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in libgcj UDP network classes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]