One other issue is that the service needs to terminate after servicing the 
request if after res.end() I call process.exit the client get a socket 
hangup error so I tried:
    req.connection.on('end', function() {
        process.exit(exitCode)
    });

but then the service process never terminates. How does the service know 
the client has gotten the response and it can exit?

Ted

On Wednesday, October 9, 2013 4:37:57 PM UTC-5, tedx wrote:
>
> Initial tests look good, thanks.
>
> Ted
>
> On Wednesday, October 9, 2013 2:38:56 PM UTC-5, Ben Noordhuis wrote:
>>
>> On Wed, Oct 9, 2013 at 9:25 PM, tedx <[email protected]> wrote: 
>> > I've written a nodejs http service that I've configured to run as an 
>> xinetd 
>> > service (basically the service receives the connected socket as 
>> > process.stdin/stdout). When the service runs it creates a http server 
>> and 
>> > then emits a 'connection' event with process.stdin. 
>> > 
>> > server = http.createServer(connectCB); 
>> > server.emit('connection', process.stdin); 
>> > 
>> > Sometimes the connect callback is called sometimes not and what I came 
>> to 
>> > realize is that when it doesn't run it is because it didn't get the 
>> 'data' 
>> > listener configured in time and it missed the http request. I also 
>> tried 
>> > using a nodejs net.Server that forks a child_process and passing the 
>> socket 
>> > with a send call but it suffers from the same issue. In the net.Server 
>> > version I tried doing a socket.pause in it's connect callback and a 
>> > socket.resume in the child process but that didn't make it work any 
>> more 
>> > consistently. I think this is something that more than myself would 
>> like to 
>> > be able to do. Anyone have thoughts on how to resolve or work around 
>> this 
>> > issue? 
>> > 
>> > Ted 
>>
>> What happens when you rewrite it like this? 
>>
>>   server = http.createServer(connectCB); 
>>   process.nextTick(function() { 
>>     server.emit('connection', new net.Socket({ fd: 0 }); 
>>   }); 
>>
>

-- 
-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to