requests are always coming on the same socket. After the TSP-Handshake server opens a new socket for the connection to the client and handles the requests over it. the socket on bound on listen-port is still there for accepting connections. OS buffers incomming requests on this socket internaly in a queue. node handles this situation in the same way as other systems do: it accepts (or rejects) the connection opens a new socket for the client-connection and calls your callback passing the connection-object. the only difference in node is, that instead of spawning new threads it emits 'connection' events and the triggering of the connection-handler-function is handled by the event-loop.
Am Mittwoch, 12. Dezember 2012 10:12:51 UTC+1 schrieb Hardik Shah: > > Hi Nikhil, > Thanks for the knowledge sharing... > As you are saying that each request is coming on different TCP socket, > then again number of socket is limited (2^16=65536 - 1024 some reserved > sockets) so as per theory it can handle at max 64k concurrent request? is > it like that? > Thanks in advance. > > > On Monday, 9 April 2012 14:36:33 UTC+5:30, Nikhil wrote: >> >> On Mon, Apr 9, 2012 at 2:32 PM, FleetCommand <amitsing...@gmail.com> >> wrote: >> > Hi all , >> > >> > I would like to know , how node.js handles if two requests come in >> parallel. >> > For example : first a dynamic http request comes wich requires some >> > processing. >> > suppose node.js is fetching parameters from request body and performing >> > some validations, >> > At the same time if a new request comoes (it can either be static file >> > serving request or dynamic). >> > So how node.js will handle this situation. >> >> Amit, >> >> Each request is still coming on a different TCP socket, for all >> purposes two different channels. >> Each of these sockets has it's own object in the JS environment as >> well (the argument to the tcp/http >> server callback). read() is done on a socket, so the two requests data >> will not overlap. >> >> Nikhil >> >> -- 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