HP3000-L Archives

August 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Gavin Scott <[log in to unmask]>
Reply To:
Gavin Scott <[log in to unmask]>
Date:
Wed, 15 Aug 2001 11:17:16 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
Mark writes:
> It's brutally ugly to obtain network interface configuration
> information such as IP address and subnet mask through standard
> Unix-like interfaces.

It's at least ugly for anyone expecting to be able to simply ask "What's my
IP address?" and get a single value back.

The first problem is that machines don't have IP addresses, network
interfaces have IP Addresses, and so a machine with multiple interfaces will
have multiple IP Addresses that will reach it.

The Unix-like APIs are fully prepared to handle multiple interfaces, and
each interface can potentially (but not actually on MPE) have multiple IP
Addresses, and in fact may have addresses that are not even "IP" addresses
for interfaces that talk to networks where IP is not the network transport
layer protocol.

So if you want to know an address, be prepared to specify which address
using which protocol on which interface.  There are APIs to enumerate these
things, but coming up with code that will determine "the" IP address is, as
Mark says, ugly (since you're asking for something that really doesn't
exist).

Getting (figuring out actually) the subnet mask is harder still, and about
the most painful (from my experience anyway) is trying to figure out the
local network broadcast address (or at least one that will actually work).

G.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2