8 Replies Latest reply on Feb 8, 2008 5:45 AM by alexcy27

    Retrieve IP

    Level 1
      Anyone knows how can I with the help of lingo or xtras get the IP of the machine running either the projector or shockwave?

      For example I want to use this as an authentication method.. I want my director to check the IP address of a machine (which will be a static one). If the machine is taken somewhere else, the IP changes, and I want director to recognize that the PC has moved locations.

      thank you
      Alex
        • 1. Re: Retrieve IP
          Level 7
          You can use Valentin's fabulous (and free) ShellXtra:

          http://staff.dasdeck.de/valentin/xtras/shell/

          I believe that the help file shows how to do a ping. Change that to
          ipconfig and you can quickly parse the return.

          Of course, you may get yourself into trouble if a machine has more than
          one network card (or even if there are more than one installed... like
          if a NIC died and the person put in another one without uninstalling the
          first). Then there may be 2 IP Addresses on the machine as far as
          windows is concerned.

          You can also pull the IP info from the registry with BuddyAPI, but it is
          not as easy as it could be... since you have to find the current network
          adapter and work your way through all that.
          • 2. Re: Retrieve IP
            Chunick Level 3
            quote:

            Originally posted by: Newsgroup User
            You can use Valentin's fabulous (and free) ShellXtra:

            http://staff.dasdeck.de/valentin/xtras/shell/

            I believe that the help file shows how to do a ping. Change that to
            ipconfig and you can quickly parse the return.


            use this command thru the shell Xtra instead of ipconfig:
            arp -a
            It's easier to parse through. If you want to check to see that you should get the right info go to start --> run --> type in 'cmd' (without single quotes) and click 'ok' button to bring up the command prompt. from there type in the arp -a command. The first entry should be the public static IP address from the ISP, but don't quote me on that... test it to make sure.
            • 3. Re: Retrieve IP
              Level 1
              THANK YOU both for the replies. The problem is that I am trying both ways and it doesn't return what I want.

              The scenario now is as follows:
              1) I am currently behind a wireless router.
              2) My IP on the machine is something like this 192.168.X.X given to my PC from the router
              3) My internet IP is 68.XXX.XX.XX given to me by my ISP (this is the IP I get when I visit sites like www.whatismyip.com)

              When I use your techniques it gives me the 192.168.X.X number and not the 68.X.X.X.
              Any way I can get to the ISP IP and not to the local IP given to me by the router?

              Thank you
              Alex
              • 4. Re: Retrieve IP
                Level 7
                I hope someone comes along and gives you a better answer than this, I
                could use it myself!

                It's my understanding that to accomplish this, you need to somehow query
                the router. I have yet to find an Xtra or other means to do it with
                Director. I don't think it is easy to do.

                Until I find another solution, I cam currently using the website you
                mentioned. They have a special page which returns just your public IP.
                So using Network Lingo you can issue a
                getNetText(" http://whatismyip.com/automation/n09230945.asp")command, and
                then after the operation completes use netTextResult which will tell you
                your public IP. (See the help on how to use these functions).

                While this works, it has some serious drawbacks. Obviously there must be
                an internet connection. Also whatismyip.com will occasionally change the
                page when someone writes a program which abuses the server. Instead of
                hard coding the site address, I store it in an external file, so that if
                they do change the page I don't have to repackage my application. I just
                have to change the site address in the external file.

                Obviously a far from perfect solution. Again, I would love to find a
                better way. Until then, this is the best I know how to do. Good luck!
                • 5. Re: Retrieve IP
                  Level 1
                  Dave C. Can you please send me a PM with your email address so I can get more info to find the address if whatismyip.com changes the URL? How do you find the new URL to put in your external file?

                  Also in case there is no internet connection, there would be some kind of error returned when using Network lingo?

                  I will give this is a shot.

                  Thank you
                  • 6. Re: Retrieve IP
                    Level 7
                    "I can get more info to find the address if whatismyip.com changes the URL?"

                    Maybe there is one, but I don't have an automated way of doing this. My
                    program requires that if the link doesn't work, you manually go to the
                    website to find out the new page and enter the URL into the external
                    text file. If there was a guaranteed automatic way of doing it, then
                    there would be no point in whatismyip.com changing the URL in first
                    place. The whole point of the way they do it is to be able to break an
                    application that is hitting the page too often. Unfortunately, this
                    means breaking everyone else's application as well.

                    If there is no internet connection netError should return 4146 instead
                    of 'OK'. If they change the URL netTextResult should return "" instead
                    of an IP address.

                    Again, not a great solution, but in my particular case it is good enough
                    until I discover something more reliable.
                    • 7. Re: Retrieve IP
                      Level 7
                      The solution is to not rely upon 3rd parties for functionality you
                      require if you don'y have a service contract with them. Set up your own
                      webserver somewhere that funs a seer side scripting language like PHP.
                      Make a page that returns the user's IP Address. Use that instead of the
                      other one.
                      • 8. Re: Retrieve IP
                        Level 1
                        Dave C: Thank you it worked fine..It gives me the IP I want..

                        Mike: I am not really familiar with web pages, so for example If I get a free page somewhere (like yahoo for example can I just upload a webpage and that would do the trick?) In essence to replace the page from "...whatismyip...asp"?

                        Thank you all for the great input.