harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spark Shen" <smallsmallor...@gmail.com>
Subject Re: [luni][net] NetworkInteface.getByName() bug
Date Mon, 27 Nov 2006 16:15:27 GMT
Well, seems the modification do take effects. Then I will submit a patch
soon.

I do have another problem. When there are more than 1 ethernet interfaces
(wireless, blue tooth etc), RI seems sort them in a specific mysterious
order.
Say, on RI (on my env, windows XP sp2), bluetooth will be named as eth0,
wireless be named as eth1, normal ethernet IF be names eth2.

Does anyone has a clue what the order is? Or, is the order of no importance?

Best regards


在06-11-27,Paulex Yang <paulex.yang@gmail.com> 写道:
>
> spark shen wrote:
> > 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
> >
> I did a basic test to modify the method hysock_get_network_interfaces
> you mentioned in following steps, it worked for me:
> 1. add a printf("hello world\n") to ln 4083 of hysock.c;
> 2. run ant build-native at classlib/trunk
> 3. run the test you provided again, it printed out like below, which I
> guess shows my modifications on portlib took effect.
>
> null
> hello world
>
> Anything I missed?
> > Best regards
> >
> >
> >
> >
> >
>
>
> --
> Paulex Yang
> China Software Development Lab
> IBM
>
>
>


-- 
Spark Shen
China Software Development Lab, IBM
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message