Re: non forking picoLisp appserver

2010-08-23 Thread Edwin Eyan Moragas
On Mon, Aug 23, 2010 at 7:10 PM, Alexander Burger  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


Re: non forking picoLisp appserver

2010-08-23 Thread Alexander Burger
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 ()
   (html 0 "Hello" NIL NIL
  "Hello World!" ) )

(let (P (port 8080)  H "@start")
   (setq *Home (cons H (chop H)))
   (loop
  (when (listen P)
 (http @)
 (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.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


non forking picoLisp appserver

2010-08-23 Thread Edwin Eyan Moragas
Hi all,

another question from your neighborhood newbie.

can i make the picoLisp app server not fork? that is, when i run
examples with the app server, it forks. and this is of course covered
by the app dev tutorial. but is there an easy way for it not to fork?

i know i am poking around. just maybe.

thanks much.

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