From: Mattias Waldau <mattias.waldau@abc.se>
To: caml-list@inria.fr
Subject: [Caml-list] Wserver: Values of global variables lost
Date: Sun, 6 May 2001 20:56:48 +0200 [thread overview]
Message-ID: <01050620563901.11893@fforum.se> (raw)
In-Reply-To: <4.3.2.7.2.20010504125129.00e25990@shell16.ba.best.com>
I am trying to use wserver, and create a simple ocaml-based webserver.
I am using it locally, and I assumed that the global variables in my ocaml
would be kept during the interaction with the user.
However, in the following program sofar is always ref "".
What have I misunderstood? How should I do? Have anyone else implemented a
minimal www-server?
My program that is compiled together with wserver, unix.cma and str.cma.
I use ocaml 3.01 on Redhat 7.1
/mattias
(* let _ = Wserver.f 2368 60 (fun _ s -> Printf.printf "You said: %s...\n" s)
*)
let sofar = ref ""
let _ =
let socket =
if Array.length Sys.argv > 1 then int_of_string Sys.argv.(1) else 2368 in
Printf.printf "\nListening on socket %d\n" socket;
flush stdout;
Wserver.f socket 60
(fun _ s ->
Printf.printf "You said: %s...(%s)\n"
(Wserver.decode s)(Wserver.decode !sofar);
sofar := !sofar ^ ", " ^ s;
prerr_string !sofar; prerr_newline ()
)
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-05-06 18:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-03 22:32 [Caml-list] printable digest strings Miles Egan
2001-05-04 9:15 ` Hendrik Tews
2001-05-04 9:37 ` Xavier Leroy
2001-05-04 14:00 ` Miles Egan
2001-05-04 14:50 ` Brian Rogoff
2001-05-04 20:27 ` Chris Hecker
2001-05-04 22:54 ` Miles Egan
2001-05-06 18:56 ` Mattias Waldau [this message]
2001-05-07 8:58 ` [Caml-list] Wserver: Values of global variables lost Daniel de Rauglaudre
2001-05-07 17:00 ` Mattias Waldau
2001-05-07 18:16 ` Daniel de Rauglaudre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01050620563901.11893@fforum.se \
--to=mattias.waldau@abc.se \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox