I just wrote a quick test and had no problems handling input from stdin and http server requests at the same time, so you will need to provide a detailed sample code before I can help you. Here is the test code that works under node 0.4.7:
var util=require('util'), http=require('http'), stdin=process.stdin; // handle input from stdin stdin.resume(); // see http://nodejs.org/docs/v0.4.7/api/process.html#process.stdin stdin.on('data',function(chunk){ // called on each line of input var line=chunk.toString().replace(/\n/,'\\n'); console.log('stdin:received line:'+line); }).on('end',function(){ // called when stdin closes (via ^D) console.log('stdin:closed'); }); // handle http requests http.createServer(function(req,res){ console.log('server:received request'); res.writeHead(200,{'Content-Type':'text/plain'}); res.end('success\n'); console.log('server:sent result'); }).listen(20101); // send send http requests var millis=500; // every half second setInterval(function(){ console.log('client:sending request'); var client=http.get({host:'localhost',port:20101,path:'/'},function(res){ var content=''; console.log('client:received result - status('+res.statusCode+')'); res.on('data',function(chunk){ var str=chunk.toString().replace(/\n/,'\\n'); console.log('client:received chunk:'+str); content+=str; }); res.on('end',function(){ console.log('client:received result:'+content); content=''; }); }); },millis);
source share