mc 2.4.2 request
Scott Raney
raney at metacard.com
Wed Mar 13 16:48:01 EST 2002
On Wed, 13 Mar 2002 Alex Shaw <A.Shaw at mailbox.gu.edu.au> wrote:
> > > Wouldn't it be nice if there was a simple function which returned
> > > the host ip address (whichever was current or a list of valid ones)
> > > without having to open a socket.
>
> >
> >What use would this be? You'd always get a list, and wouldn't know
> >which one would be used until you actually opened a socket.
> > Regards,
> > Scott
>
> In respect to a particular app I'm developing.. just a simple p2p mac/pc
> file/msg transfer program.
>
> I can't have a server involved (yet), and the users know little about ftp
> etc but they do understand what a phone number is, so basically the IP
> address of their machine becomes their 'phone number'. Instead of providing
> each with a piece of paper with their IP address (not helpful because the
> users could be anywhere) I would like them to just run the app.. if
> connected to the internet use the IP for that (andu suggested a check for
> www.yahoo.com but who can guarantee yahoo be around a year from now) else
> connected via LAN adpater so display the associated address (in this
> particular case I know the users will have either a modem or 1 LAN
> adapter). Once they know their IP address, that can be shared with other
> users etc.. & they can 'dial' & connect with each other. Just easier from a
> user (& programming) perspective.
Unfortunately I think this won't work. IP addresses change, in some
cases with each time you open a connection. At the very least, with
DHCP (which most large networks use), you can get a different address
each time the machine reboots. The only way to do what you want is to
have some sort of server that collects the IP addresses and
distributes them to the other clients. And of course this means
opening a connection to a server, at which point figuring out the
local IP address is a no brainer because it comes in as a parameter
with the socket messages you get from that server.
Regards,
Scott
> regards
> alex
********************************************************
Scott Raney raney at metacard.com http://www.metacard.com
MetaCard: You know, there's an easier way to do that...
More information about the metacard
mailing list