On Mon, Aug 23, 2010 at 7:10 PM, Alexander Burger <a...@software-lab.de> wro=
te:
> Hi Edwin,
>
>> can i make the picoLisp app server not fork? that is, when i run
>
> There was a discussion about that here in 2008. You can easily make a
> non-forking server by not calling the standard 'server' function which
> automatically forks upon a connect, but use a 'listen'ing loop instead:
>
> ################################################################
> #!bin/picolisp lib.l
>
> (load "ext.l" "lib/http.l" "lib/xhtml.l")
>
> (allowed () "@start")
>
> (de start ()
> =A0 (html 0 "Hello" NIL NIL
> =A0 =A0 =A0"Hello World!" ) )
>
> (let (P (port 8080) =A0H "@start")
> =A0 (setq *Home (cons H (chop H)))
> =A0 (loop
> =A0 =A0 =A0(when (listen P)
> =A0 =A0 =A0 =A0 (http @)
> =A0 =A0 =A0 =A0 (close @) ) ) )
> ################################################################
>
> This loops infinitely, listening on port 8080. When a request arrives,
> it is handled, and the connection closed.
>
> This works, but has disadvantages like denying further requests while a
> transaction is running, and not being able to keep state information in
> a session the way the child processes do after a fork. For certain
> special cases it might well make sense, though.


thank you Alex.

cheers,

/eyan
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to