Most recent activity
-
-
@possmann I am using 1v69
-
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.
-
-
- 6 comments
- 2,897 views
-
@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);
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.