• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

NetworkInterface.isUp() is returning false for the interface which is up

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a strange problem, windows ipconfig/all is showing the interface with ipaddress. But java is returning false for isUp() for the NetworkInterface.

I am running this code on Windows.

Here is the piece of code:
Enumeration<NetworkInterface> nwIfs = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface nwIf : Collections.list(nwIfs)) {
System.out.println("Interface = " + nwIf);
System.out.println("Interface is Up =" + nwIf.isUp());
System.out.println("Interface is virtual =" + nwIf.isVirtual());
System.out.println("Interface MTU =" + nwIf.getMTU());
System.out.println("Interface parent =" + nwIf.getParent());
System.out.println("Interface is loopback =" + nwIf.isLoopback());
System.out.println("Interface is point to point =" + nwIf.isPointToPoint());
System.out.println("Interface support Muticast =" + nwIf.supportsMulticast());

Here is the output:

Interface = name:eth4 (AAAAAAAA) index: 0 addresses:
/10.1.20.2;

Interface is Up =false
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true

Here is the ipconfig output for the interface
Ethernet adapter XXXXXXX:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : AAAAAAAA
Physical Address. . . . . . . . . : XX-XX-XX-XX-XX-XX
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.1.20.2(Preferred)
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . :
NetBIOS over Tcpip. . . . . . . . : Enabled

Any clue why the NetworkInterface code is behaving this way.
I have already posted this in forums.oracle.com, but didn't get any response.
 
Ravikanth Boorugadda
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more observation is , index is 0 for all the interfaces.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I executed the same program. I got the results as expected. Please check the permission of user profile. Please also check the java version.
 
Marshal
Posts: 26537
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravikanth Boorugadda wrote:One more observation is , index is 0 for all the interfaces.



Index?
 
Raghu Shank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the interface also. Please see the output below.

Interface is Up =true
Interface is virtual =false
Interface MTU =1520
Interface parent =null
Interface is loopback =true
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth0 (VMware Virtual Ethernet Adapter for VMnet8) index: 2 addresses:
/192.168.63.1;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth1 (VMware Virtual Ethernet Adapter for VMnet1) index: 3 addresses:
/192.168.221.1;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
Interface = name:eth2 (Intel(R) 82566DM Gigabit Network Connection - Teefer2 Miniport) index: 4 addresses:
/10.10.98.183;

Interface is Up =true
Interface is virtual =false
Interface MTU =1500
Interface parent =null
Interface is loopback =false
Interface is point to point =false
Interface support Muticast =true
 
knowledge is the difference between drudgery and strategic action -- tiny ad
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic