
Getting a users IP address
Why are you bothering to work with the byte order ?? If you want a
dotted string representation of the address just use this ...
Sub form_Load()
ipLbl.Caption = "This machine's IP address is : " + winsockCtrl.LocalIP
End Sub
Parse the string if you want the parts ... The winsock control has all
the necessary functions for converting, e.g. htol, if you really want to
work at that level ...
Quote:
> I have a good, albeit not simple way of doing this. It's called Winsock. I
> use it to get the ip address of each of my users when they log into our app
> suites. The pseudo code looks something like this.
> Open a winsock session
> Get the ip in network byte order ( the natural way that the API deals with
> the ip )
> Reverse the byte order
> I now have the ip address
> close the winsock session
> This is especially useful on NT networks that use DHCP since that IP only
> applies to that particular login session. You can also use it to get the
> service ip for any sub service that might be using a different IP such as
> FTP, etc. If this still is not enough information then I will send you a
> code snippet privately through e-mail.
> --
> Your friendly neighborhood Claude :-)
> > Sorry can't help you more, but there ~is~ a utility in Windows 95 that
> > provides the IP address (a golf game called LinksLS 1998 by Access
> Software
> > calls it).
> > Hope that steers you in the right direction,
> > Greg C
> > >Would like to know if anyone has found a good source for getting their
> > >machines IP address on the Net.
> > >I would like for the people who use my program on the Internet, to have
> > >their IP address displayed or / and other practical information.
> > >Thanks,
> > >S. Cogan