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, Dec 04, 2003 at 02:38:58AM +0100, Norbert Frese wrote:
> On Wed, 2003-12-03 at 21:56, Michael Koch wrote:
> > On Wed, Dec 03, 2003 at 12:49:40PM -0700, Tom Tromey wrote:
> > > >>>>> "Norbert" == Norbert Frese <postfach@nfrese.net> writes:
> > > 
> > > Norbert> ... got curious myself ... and i think i have found it: 
> > > Norbert> The buffer size which is told to recvfrom() in
> > > Norbert> "gnu::java::net::PlainDatagramSocketImpl::receive" is the size of the
> > > Norbert> previously received Packet. Which is kept in the "length" variable of
> > > Norbert> DatagramPacket. Therefore the number of bytes read via recvfrom() gets
> > > Norbert> reduced with every packet that is smaller than the previous one.
> > > 
> > > Did this ever get resolved?
> > > If not, could you file the problem in bugzilla?
> > 
> > This is fixed in CVS and Norbert's testcase works like a charm. The only
> > missing piece is a mauve test ...
> > 
> > 
> > Michael
> > 
> 
> Thanks, Michael, for fixing the incompatibilities i have found. I am
> trying to write a more comprehensive datagram-packet test because there
> are still differences to the JDK - you can download udp_testsuite2 from
> the link below - perhaps we need two seperate fields for setLength() and
> getLength().
> 
> My proposal:
> 
> 2 fields: 'maxlen' and 'length'
> 
> setLength() sets both 'maxlen' and 'length' to the same value.
> 
> send() sends a Packet with 'length' bytes.
> 
> receive() reads not more than 'maxlen' bytes and sets 'length' to the
> actual number of bytes received.
> 
> getLength() returns 'length'
> 
> The problem is, that this would require the fields to be public, because
> we can't simply use getLength and setLength from CNI.

Your idea is excellent. I commited a fix. The fields dont have to be public.
package-private (default) access is enough. package-private is mapped to
public in the C++ header file. Thats why access from CNI code is possible
from gnu/java/net/natPlainDatagramSocket*.cc.
 
> How does this mauve test stuff work? Is there a tutorial?

The best tutorial so far are the existing mauve tests in mauve cvs. Look
at http://sources.redhat.com/ for Mauve.


Michael


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