Created
June 20, 2012 22:02
-
-
Save jonmarkgo/2962501 to your computer and use it in GitHub Desktop.
tcp setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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