Home AMX User Forum NetLinx Studio

IP connectivity

I'm just wondering what IP address of websites are prefered to check IP connectivity. I was using Verizon.net but it was changed recently.

Comments

  • viningvining Posts: 4,368
    What are you actually trying to accomplish? Just verifying connection to the outside world or are you trying to connect and download pages for practice.
  • flcusatflcusat Posts: 309
    Yeah, just verifying connection. I have a customer with a property in Bahamas that wants to check the cameras remotely.The problem is the ISP there is not reliable and having to reboot the router a couple of times a day is very common there.. I'm controlling the power to the router with a PC1. The controller pings a web site and on error cuts the power to the router, waits x amount of time and checks the IP again.
  • viningvining Posts: 4,368
    If you're pinging through the master I would think a loop back through the routers or cameras dynamic dns service would work sufficiently and if you're actually connecting to a site try putting a test page on your companies website that doesn't have access through the website itself. A simple HTML page with "Test Successful!". Then you just have to make sure your website is running and not some one elses. Plus the page will never change unless you yourself change it.
  • flcusatflcusat Posts: 309
    Thanks Vining. The cameras are conected to a Dedicated Micros DVR.
  • AMXJeffAMXJeff Posts: 450
    flcusat wrote:
    Thanks Vining. The cameras are conected to a Dedicated Micros DVR.

    This website returns your external IP address, this format never changes, because people need this for dynamic dns. If you do not want to setup your own website page just for this pupose. This is very easy to parse...

    http://checkip.dyndns.com:8245/
  • flcusatflcusat Posts: 309
    Thanks Jeff, I never though about this one.
  • ericmedleyericmedley Posts: 4,177
    AMXJeff wrote:
    This website returns your external IP address, this format never changes, because people need this for dynamic dns. If you do not want to setup your own website page just for this pupose. This is very easy to parse...

    http://checkip.dyndns.com:8245/
    AMX also has this service

    http://www.amx.com/ip.asp
  • ericmedley wrote:
    AMX also has this service

    http://www.amx.com/ip.asp

    I have tried connecting to both DynDNS and AMX, but I get an error when i try to connect to anything but the root of the domain (e.g. www.amx.com not www.amx.com/ip.asp). At least the DynDNS address is part of the FQDN. Any ideas how to navigate known server directory structure?
  • ericmedleyericmedley Posts: 4,177
    Sighlynt wrote:
    I have tried connecting to both DynDNS and AMX, but I get an error when i try to connect to anything but the root of the domain (e.g. www.amx.com not www.amx.com/ip.asp). At least the DynDNS address is part of the FQDN. Any ideas how to navigate known server directory structure?

    http://www.amx.com/ip.asp is the link I just copied from my browser. It worked for me. It is just a web page. How are you trying to access it?
  • IP_CLIENT_OPEN(dvCheckIP.Port,'www.amx.com/ip.asp',80,IP_TCP)
    
    I Get
    Line 2 :: UNKNOWN HOST: www.amx.com/ip.asp - 11:05:58
    Line 3 :: ClientOpen mxInetAddr or hostGetNyName error 0x0 - 11:05:58

    I made sure that my master has the correct DNS and everything.
  • DHawthorneDHawthorne Posts: 4,584
    Sighlynt wrote:
    IP_CLIENT_OPEN(dvCheckIP.Port,'www.amx.com/ip.asp',80,IP_TCP)
    
    I Get
    Line 2 :: UNKNOWN HOST: www.amx.com/ip.asp - 11:05:58
    Line 3 :: ClientOpen mxInetAddr or hostGetNyName error 0x0 - 11:05:58

    I made sure that my master has the correct DNS and everything.

    You are asking the server to run a script. IP_CLIENT_OPEN will do that all by itself. You have to open the connection to www.amx.com without the /op.asp, then issue a GET command through that connection. A browser does this all automatically; you need to do it in the code. This is going to be true of any web service. Open the connection to the server, then send whatever is necessary for that particular server to get what you want.
  • You are correct in saying the connection is not the problem. I looked at the http string and changed the host inside the get string to the following
    SEND_STRING dvCheckIP,"
    	    'GET / HTTP/1.1',13,10,
    	    'Host: www.amx.com/ip.asp',13,10,
    	    'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.5',13,10,
    	    'Accept: text/plain;q=0.8',13,10,
    	    'Accept-Language: en-us',13,10,
    	    'Accept-Charset: utf-8;q=0.7',13,10,13,10"
    

    But I get this
    Line      8 :: Dump = 
    HTTP/1.1 400 Bad Request$0D$0A
    Content-Type: text/html$0D$0A
    Date: Tue, 04 Dec 2007 18:00:05 GMT$0D$0A
    Connection: close$0D$0A
    Content-Length: 3 - 12:01:30
    

    Any ideas?
  • jjamesjjames Posts: 2,908
    ericmedley wrote:
    AMX also has this service

    http://www.amx.com/ip.asp
    Many thanks to you (and AMX) for this - I'm sick and tired of parsing showmyip.com's XML portion. Too much junk in it, and takes too long to connect. I'm definitely using this one from now on. (Watch AMX take it down now . . . blah!)
  • HedbergHedberg Posts: 671
    On of the NIST time servers could also be used for this purpose.
  • viningvining Posts: 4,368
    Here's some exmples that may be helpful.

    Just change the URL and file names to match the one you want to use. There are examples of other HTTP commands that you can play around with but I found no real purpose for them, not yet any way.

    You'll need to use the Connect function which you can call by a button push or a timed event. Once the Connect function is called and you're connected to the server an online event will occur and trigger the GET function and with luck you'll receive data and trigger the string_event.

    You can get rid of the paremeter in the connect function. That's just there so I can see what called the function in debug.
    DEFINE_FUNCTION CHAR fnConnectCableVision(CHAR iFromWhere [])//used
         //http://en.wikipedia.org/wiki/HTTP_OPTIONS#Request_methods
         {//http://en.wikipedia.org/wiki/HTTP#Status_codes
         if (nCATV_Debug)
    	  {
    	  send_string 0,"'Time ',Time,' - Connecting to CableVision! From: *-',iFromWhere,'-* line-<',ITOA(__LINE__),'>',crlf" ;
    	  }
         ip_client_open (dvCableVision.Port,'www.cablevision.com',80,1) ;
         RETURN TRUE ;
         }
    
    DEFINE_FUNCTION CHAR fnTraceCableVision()//not used
    
         {//http://en.wikipedia.org/wiki/HTTP#Status_codes
         SEND_STRING dvCableVision,"'TRACE /index.jhtml?pageType=lineup&regionId=',
    				   itoa(sCableCity[nCurrentCableCity].CityCode),'&digital=1 HTTP/1.1',CR,LF" ;
         SEND_STRING dvCableVision,"'Host: www.cablevision.com',CR,LF" ;
         SEND_STRING dvCableVision,"CR,LF" ;//blank line required
         if (nCATV_Debug)
    	  {
    	  SEND_STRING 0,"'dvCableVision TRACE Request Sent! line-<',ITOA(__LINE__),'>',CR,LF" ;
    	  }
         RETURN TRUE ;
         }
         
    DEFINE_FUNCTION CHAR fnOptionsCableVision()//not used
         
         {//http://en.wikipedia.org/wiki/HTTP#Status_codes
         SEND_STRING dvCableVision,"'OPTIONS /index.jhtml?pageType=lineup&regionId=',
    				   itoa(sCableCity[nCurrentCableCity].CityCode),'&digital=1 HTTP/1.1',CR,LF" ;
         SEND_STRING dvCableVision,"'Host: www.cablevision.com',CR,LF" ;
         SEND_STRING dvCableVision,"CR,LF" ;//blank line required
         if (nCATV_Debug)
    	  {
    	  SEND_STRING 0,"'dvCableVision OPTIONS Request Sent! line-<',ITOA(__LINE__),'>',CR,LF" ;
    	  }
         RETURN TRUE ;
         }
    
    DEFINE_FUNCTION CHAR fnHeadCableVision()//not used
    
         {//http://en.wikipedia.org/wiki/HTTP#Status_codes
         SEND_STRING dvCableVision,"'HEAD /index.jhtml?pageType=lineup&regionId=',
    				   itoa(sCableCity[nCurrentCableCity].CityCode),'&digital=1 HTTP/1.1',CR,LF" ;
         SEND_STRING dvCableVision,"'Host: www.cablevision.com',CR,LF" ;
         SEND_STRING dvCableVision,"CR,LF" ;//blank line required
         if (nCATV_Debug)
    	  {
    	  SEND_STRING 0,"'dvCableVision HEAD Request Sent! line-<',ITOA(__LINE__),'>',CR,LF" ;
    	  }
         RETURN TRUE ;
         }
    
    DEFINE_FUNCTION CHAR fnGetCableVision()//used 
    
         {                                                                      
         SEND_STRING dvCableVision,"'GET /index.jhtml?pageType=lineup&regionId=',
    				   itoa(sCableCity[nCurrentCableCity].CityCode),'&digital=1 HTTP/1.1',CR,LF" ;
         SEND_STRING dvCableVision,"'Host: www.cablevision.com',CR,LF" ;
         SEND_STRING dvCableVision,"CR,LF" ;//blank line required
         if (nCATV_Debug)
    	  {
    	  SEND_STRING 0,"'dvCableVision GET Request Sent! line-<',ITOA(__LINE__),'>',CR,LF" ;
    	  }
         RETURN TRUE ;
         }
    
    DATA_EVENT [dvCableVision]
    
         {
         ONLINE:
    	  {//Head
    	  fnGetCableVision() ;
    	  on [dvTPCableVision,1] ;
    	  }
    ............................
    
    
  • ericmedleyericmedley Posts: 4,177
    jjames wrote:
    Many thanks to you (and AMX) for this - I'm sick and tired of parsing showmyip.com's XML portion. Too much junk in it, and takes too long to connect. I'm definitely using this one from now on. (Watch AMX take it down now . . . blah!)

    you are welcome. That's what's cool about this forum. I've received lost of help here as well.

    ejm
Sign In or Register to comment.