Find the answer to your Linux question:
Results 1 to 2 of 2
Does anybody know how to get external ip address with c and socket? To make things clear, A linux machine may have multiple ip address, for example, 127.0.0.1 (local ip ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    1

    how to get external ip address?

    Does anybody know how to get external ip address with c and socket?

    To make things clear,

    A linux machine may have multiple ip address, for example,

    127.0.0.1 (local ip address)
    198.12.1.12 (external address)

    if there a c function like getaddrinfo(..) which can get the external address(198.12.1.12), rather than the local address(127.0.0.1)?

    Thanks a lot.

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    I don't know how, but the tool ifconfig can tell such things.
    So I would browse the source code of that tool to look how it does the job.
    Debian GNU/Linux -- You know you want it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...