[Ilugc] Find IP address of a machine
- From: binand@xxxxxxxxx (Binand Sethumadhavan)
- Date: Tue Oct 24 11:29:17 2006
On 24/10/06, Girish Venkatachalam <girishvenkatachalam@xxxxxxxxx> wrote:
Well, a given machine could have several different IP addresses, so
you need to be a bit more specific than that.
There are both multi homed and single interface having mutiple IP addresses
problem.
There are also NAT, multicasting, hot-standby protocols like
VRRP/CARP, load-balancing etc. that causes an IP address to be
associated with a given machine.
The point is that an IP address is not a property of the machine, so a
question like "how do I figure out the OP address of a machine?" is
meaningless. IP addresses are properties of TCP/IP connections, not of
machines/computers/hardware.
Given that, the way to figure out IP addresses at both ends of a
connection are the pair of system calls getsockname/getpeername
(perldoc -f for their usage details).
Binand
Other related posts: