Avatar for user47955

user47955

Member since Aug 2014 • Last active Sep 2014
  • 4 conversations
  • 20 comments

Most recent activity

  • in General
    Avatar for user47955

    OK maybe not.

    Just set it back to use the Linux server DNS and it is working fine now.

    Not having to call the eth.setIP() after each http.get() call either.

    Strange.

  • in General
    Avatar for user47955

    Interestingly if I use a Windows DNS server on my network it all seems to work without issue.

    If using a Linux DNS server on my network then I get the errors and timeouts after the first successful http.get().

    The Linux DNS server is used for all the other clients on the network without issue.

  • in General
    Avatar for user47955

    @possmann I am using 1v69

  • in General
    Avatar for user47955

    Just got my WIZnet modules from DigiKey and mostly working.

    DHCP is fine.

    However getting: ERROR: Socket error -7 while sending

    This is normally after doing a few http.get() requests.

    I have spaced the get requests 30 seconds apart but still getting them unfortunately.

    Running eth.setIP() does seem to help though and get it back working, for at least 1 request.

    Sometimes will then work for 2 or 3 requests but normally only 1.

  • in JavaScript
    Avatar for user47955

    Many thanks Gordon.

    Keep up the excellent work.

    • 6 comments
    • 2,865 views
    • 8 comments
    • 3,362 views
  • in JavaScript
    Avatar for user47955

    @gordon yes correct.

    Not sure what it returns on its second call but it errors.

    How do you dump the contents of the variable to see what it is set to and I can let you know.

    If I do console.log("" + wlan) all I get is [object Object] both times.

    This code works:

    var wlan = require("CC3000").connect();
    
    function getTime() {
      // if we don't get DHCP or a complete request in 30 seconds,
      // disconnect
      var failTimeout = setTimeout(function() {
        console.log("Timed out, disconnecting...");
        wlan.disconnect();
      }, 30000);
      wlan.connect( "AccessPointName", "WPA2key", function (s) {
        if (s=="dhcp") {
          require("http").get("http://www.pur3.co.­uk/time.php",
                              function(res) {
            // store the result
            var result = "";
            res.on('data', function(data) {
              result += data;
              console.log(data);
            });
            /* When the connection closes, print what we
            got, and then disconnect from WiFi */
            res.on('close', function() {
              console.log("Got: "+result);
              // finished, disconnect anyway
              setTimeout(function() {
                clearTimeout(failTimeout);
                console.log("Complete!, disconnecting...");
                wlan.disconnect();
              },1000);
            });
          });
        }
      });
    }
    
    // Every 24 hours, get the time again
    setInterval(getTime, 24*60*60*1000);
    

    This doesnt work:

    function getTime() {
      // if we don't get DHCP or a complete request in 30 seconds,
      // disconnect
      var failTimeout = setTimeout(function() {
        console.log("Timed out, disconnecting...");
        wlan.disconnect();
      }, 30000);
      var wlan = require("CC3000").connect();
      wlan.connect( "AccessPointName", "WPA2key", function (s) {
        if (s=="dhcp") {
          require("http").get("http://www.pur3.co.­uk/time.php",
                              function(res) {
            // store the result
            var result = "";
            res.on('data', function(data) {
              result += data;
              console.log(data);
            });
            /* When the connection closes, print what we
            got, and then disconnect from WiFi */
            res.on('close', function() {
              console.log("Got: "+result);
              // finished, disconnect anyway
              setTimeout(function() {
                clearTimeout(failTimeout);
                console.log("Complete!, disconnecting...");
                wlan.disconnect();
              },1000);
            });
          });
        }
      });
    }
    
    // Every 24 hours, get the time again
    setInterval(getTime, 24*60*60*1000);
    
Actions