-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CC3K can't connect to localhost/127.0.0.1 [or even own network IP address?!] #60
Comments
I don't really blame the CC3K for this one, as connections to that IP address are usually done through a separate loopback interface…but how should we handle this in both tests and any code that might rely on this? (Note the situation isn't unheard of, IIRC Heroku doesn't route localhost either.) |
Related-ish, though perhaps deserves it's own issue: "localhost" does not resolve on Tessel either. |
Hmmm, also related-ish, the CC3K doesn't seem to be able to connect to itself at all, perhaps. Noticed this while trying to test tessel/t1-runtime#336 with this script, modified to hardcode the IP address reported by var net = require('net');
var server = net.createServer(function (c) {
console.log("connection");
c.on('end', function () {
console.log("connection end");
});
c.end("«§»");
});
server.listen(0, function () {
console.log("listening");
testConnection(server.address().port);
});
function testConnection(port) {
console.log("testConnection", port);
//return;
var client = net.connect(port, "192.168.4.122").on('data', function (d) {
console.log(d.toString());
setTimeout(function () {
console.log("*** CLOSE ***");
server.close();
//client.end();
}, 2e3);
});
} This basically hangs after the "testConnection" log, the on-Tessel client doesn't connect (IIRC eventually times out with an error UPDATE: nope) although I can telnet to the server from my laptop as expected. |
At a broader level, there's already at least one other network interface that would like to play on Tessel: https://forums.tessel.io/t/tcp-commands-with-gprs-chip-not-working-as-expected-another-node-stream-issue/287/2 Maybe this is a situation (much like 'fs' module vs sdcard filesystems) where the firmware "kernel" itself needs to play better at routing calls? |
@natevw, loopbacks aren't implemented in hardware. How does Heroku handle this? |
That's what I mean, on Tessel we don't support multiple "drivers" and so adding one for a software loopback interface (or a cell module) doesn't fit the current architecture. It's been a while and I didn't probe deeply with Heroku, just IIRC I couldn't make a connection to my own server from itself. This "making a client connection to own server" is the reason I noticed it, since that's what some of the 'net' module tests do — in practice it's probably not a showstopper for many "real" use case. |
runtime/test/suite/net.js fails with this error:
The text was updated successfully, but these errors were encountered: