Getting cross-platform IP address
Dar Scott
dsc at swcp.com
Wed Aug 27 18:38:01 EDT 2003
On Wednesday, August 27, 2003, at 04:56 PM, Alex Rice wrote:
>> I think the goal is to get the primary IP address of the computer not
>> of a connection. I may be confused there, too.
>
> But is there such thing as really a primary IP address? There is a
> default gateway for each network interface. There can be priorities
> assigned to different routes. However, the particular interface to use
> isn't decided until the OS needs to send some particular network
> packets and the OS goes- ok little packet: where's that network-
> where's that default gateway- what's the route's priority hm.. hm...
> you go out this interface.
>
> Maybe this is why hostAddress requires a socket to be opened- it is
> only capable of answering the endpoint IPs of that one socket.
That is a very good point.
I have some computers with several ethernet adaptors, some over-modem
adaptors, and several VPN adaptors. And then there is 127.0.0.1. I
have some computers which connect to multiple subnets on the same
ethernet adaptor. Which is primary?
I think Windows thinks one is primary, but I'm not sure.
This is why I like the idea of an adaptors() or ipAddresses() function.
Or the ability of hostAddress to take an unopened connection.
Now if only hostAddress will take a UDP opened socket... That is
really in some sense an unopened connection.
Dar Scott
More information about the use-livecode
mailing list