harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spark shen <smallsmallor...@gmail.com>
Subject [luni][net] NetworkInteface.getByName() bug
Date Mon, 27 Nov 2006 09:30:08 GMT
Hi All:
I found a bug of NetworkInterface.getByName() on harmony;It can be
revealed by the following Test case:

import java.net.NetworkInterface;
import java.net.SocketException;

public class HelloSpark {

public static void main(String[] args) throws SocketException {
System.out.println(NetworkInterface.getByName("eth0"));
}
}
================================================================
When executed against harmony, this method will return null on my
machine. And I do have eth0 running. After some investigation, I found
harmony retrieved wrong name for NetworkInterface.

import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;

public class HelloSpark {

public static void main(String[] args) throws SocketException {
//TODO not yet implemented
Enumeration<NetworkInterface> nif = NetworkInterface.getNetworkInterfaces();
while(nif.hasMoreElements()) {
System.out.println(nif.nextElement());
}
}

}

On HY:
[{655771A5-B1CC-4DFA-BDC4-6822587311EE}][本地连接 2][/9.181.106.82]
[MS TCP Loopback interface][MS TCP Loopback interface][/127.0.0.1]

On RI:
name:lo (MS TCP Loopback interface) index: 1 addresses:
/127.0.0.1;

name:eth0 (Intel(R) PRO/1000 MT Network Connection - ????ü??????ò?????)
index: 2 addresses:
/9.181.106.82;

This demonstrates my point.
========================================================================
And then, I found the cause:
hysock_get_network_interfaces(portlib\src\main\native\port\windows\hysock.c)
was called to retrieve NetworkInterface related information. This
function is not properly implemented.
========================================================================
And, at last(Thank you for your patience reading this long :-) ). The
problem is, modification into this method takes no effects. Would any
one help me with that? This method is within portlib

Best regards




Mime
View raw message