[kaffe] Bug Report - InetAddress.getHostAddress() returns null for a received DatagramPacket

Everton da Silva Marques everton at lab.ipaccess.diveo.net.br
Mon Sep 29 11:49:02 PDT 2003


Hi,

This is a problem under Kaffe 1.1.1 on i686-pc-linux.

When I try to get the source address of a received
multicast packet, getHostAddress() fails and returns
a null pointer instead.

The code below shows the problem. It shows the
"getHostAddress() failed" message on stderr.

  byte[] buffer = new byte[1024];
  DatagramPacket multicastPacket = new DatagramPacket(buffer, buffer.length);

  try {
    multicastSocket.receive(multicastPacket);
  }
  catch (IOException e) {
    System.err.println("failure receiving packet: " + e);
  }

  InetAddress sourceAddress = multicastPacket.getAddress();
  if (sourceAddress == null)
    System.err.println("getAddress() failed");

  String srcAddr = sourceAddress.getHostAddress();
  if (srcAddr == null)
    System.err.println("getHostAddress() failed");

This code works under gcj-compiled binaries and under
Sun's JVM, but fails with Kaffe.

Is this known?

Is there a fix?

Thanks,
Everton






More information about the kaffe mailing list