You may try like the following: var totalData; socket.on('data', function(data){ totalData += data; })
and then run all actions step by step elsewhere depended on your html parser. The html parsing may be the same as sokect.on(); Jack於 2012年5月17日星期四UTC+8下午1時24分34秒寫道: > > I have some problem. I have mini socket server. > > var net = require('net'); > var server = net.createServer(function (socket) { > socket.on('data', function(data){ > // here i do xml parsing and run some action > var xml2js = require('xml2js'), parser = new xml2js.Parser(); > parser.addListener('end', function(result) { > var command = require(result['@']['action']); > var c = new command(socket); > c.run(); > }).parseString(data); > }); > }); > server.listen('8081', '127.0.0.1'); > > > Good, but if i send many commands to server like this: > > telnet 127.0.0.1 8081 > <query action="some_action1"></query> > <query action="some_action2"></query> > <query action="some_action3"></query> > > My server is executing this action is asynchronous. How i can get > running this actions is step by step ? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en