Skip to content

Instantly share code, notes, and snippets.

@jonmarkgo
Created June 20, 2012 22:02
Show Gist options
  • Save jonmarkgo/2962501 to your computer and use it in GitHub Desktop.
Save jonmarkgo/2962501 to your computer and use it in GitHub Desktop.
tcp setup
tcpServer.on('connection', function (socket) {
console.log('num of connections on port 1337: ' + tcpServer.connections);
arduinoTcp = socket;
socket.on('data', function (mydata) {
console.log('received on tcp socket:' + mydata);
curr_call.load(function (err, call) {
if (err) {
throw err;
}
if (!isNaN(mydata)) {
curr_call = call;
call.liveCb(function (err, subcall) {
if (err) {
throw err;
}
subcall.gather(getDigits, {numDigits: 1}).say(mydata + " inches");
});
}
});
});
});
tcpServer.listen(1337);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment