The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM


SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
interface may off fredginting SUN Solaris 7 05-22-2008 06:50 AM
how i prepare a c++ code(c code) for implementing my own protocol format amitpansuria High Level Programming 1 09-06-2007 08:09 PM
Network interface Qfe, ce, bge ... unclefab SUN Solaris 1 10-30-2006 04:37 AM
SSH key code versus server key code Texan Security 1 04-12-2006 08:57 AM
sco GUI interface qphillips SCO 1 09-27-2005 03:16 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-2008
Registered User
 

Join Date: Sep 2007
Location: Huntsville, Alabama
Posts: 6
Question Getting interface names using code

Is there a way to use code to get the interface names for a Solaris machine. I can easily see them on a command line with the "ifconfig -a" command. I could write a script that parses these out of a the ifconfig result and outputs them to a file, and then I run the script with the system command from code, and open the resulting file from code.

It seems there should be an easier way for a program to get these names. On some of the Solaris boxes I use, these names are bge0, bge1,... depending on how many ethernet cards are installed. On others the names are ce0, ce1,...

If you know how I can get these names from code directly, please let me know.
TIA,
Herb Miller
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-10-2008
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,503
Are you only concerned with active network interfaces?
Reply With Quote
  #3 (permalink)  
Old 07-10-2008
Registered User
 

Join Date: May 2008
Location: s'pore
Posts: 541
use can use prtconf -D |grep network to see each interfaces' instances. and of course, if you need only the active interface, you can use ifconfig or the combination of both, depending on how stylish you want your script to report it out with the output
Reply With Quote
  #4 (permalink)  
Old 07-10-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,999
I'm not 100% sure what the OP means but 'code', but my foggy crystal ball tells me it's not "script", but rather some kind of the compiled language.
Maybe the OP could shed some more light....
Reply With Quote
  #5 (permalink)  
Old 07-10-2008
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,503
That was my understanding also.
Reply With Quote
  #6 (permalink)  
Old 07-10-2008
Registered User
 

Join Date: Sep 2007
Location: Huntsville, Alabama
Posts: 6
Getting interface names using code

I may be in the wrong forum.

I was hoping to do this from code (C++ or C, most likely). I can use the ifconfig command from code and pipe the result of a file and open the file and parse it. This seems cumbersome, but it does work.

I was hoping to just make some calls (or series of calls) from software to get this information rather that relying on the "system_ command from software, and writing and reading a file. I can not be sure that the code I am writing will be run in an environment where writing a file is permitted.

Thanks,
Herb
Reply With Quote
  #7 (permalink)  
Old 07-10-2008
Registered User
 

Join Date: Sep 2007
Location: Huntsville, Alabama
Posts: 6
Yes, active interfaces only.
Reply With Quote
Google UNIX.COM
Reply

Tags
linux, solaris

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0