LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-06-2013, 10:49 AM   #1
yrs7
LQ Newbie
 
Registered: Apr 2006
Distribution: OpenSUSE, Debian, RedHat, FreeBSD
Posts: 6

Rep: Reputation: 0
How to display a list of available network interfaces' IP addresses


Hi,

I'm writing a server and a client programs. For the server part, I want it to display a list of its available network interfaces. This way, a user can choose which interface for the server to use. Any suggestions, guys?

yrs7
 
Old 06-06-2013, 11:00 AM   #2
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
The command line can display all availiable interfaces (connected or otherwise) with

[CODE]
iwconfig
[\CODE]
 
Old 06-06-2013, 11:05 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Well I am sure there are plenty of suggestions ... My first would be ... in what language??
 
Old 06-07-2013, 12:49 AM   #4
jason_m
Member
 
Registered: Jun 2009
Posts: 33

Rep: Reputation: 12
If you are interested in using C, this recent/current thread should help you out:
http://www.linuxquestions.org/questi...al-4175464150/

Note that getifaddrs() is not part of the POSIX standard, although it is available on BSD and Linux (if you are on Windows, you likely need a different solution.)
 
Old 06-07-2013, 01:41 PM   #5
yingjusuen
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by yrs7 View Post
Hi,

I'm writing a server and a client programs. For the server part, I want it to display a list of its available network interfaces. This way, a user can choose which interface for the server to use. Any suggestions, guys?

yrs7
p.s. I use C and Berkeley socket.
 
Old 06-08-2013, 04:40 PM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Please see my example in your other thread of a very similar topic. It gives you both interface names and their associated IP addresses. Also, why does it seem like you have two accounts?

Kevin Barry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Communication between two Network Interfaces (with IPv6 addresses) within same system peeyushpd Linux - Networking 2 03-18-2012 02:04 PM
Setup with 2 ethernet interfaces and 2 IP addresses in the same subnet of a class C ursusca Linux - Networking 3 12-25-2008 04:21 PM
How to get a list of IP addresses currently on the network? puszikam Linux - Networking 22 12-14-2008 09:48 PM
Where to access the interfaces IP addresses Zack Alamy Linux - Networking 4 11-07-2008 08:14 AM
Detecting IPv6 addresses of interfaces obashir Programming 4 11-13-2002 07:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration