Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Ivan Gotovchits <ivg@ieee.org>
To: Daniil Baturin <daniil@baturin.org>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Handling concurrent connections with Lwt
Date: Mon, 4 May 2015 13:33:11 -0400	[thread overview]
Message-ID: <CALdWJ+xqFZG4apsysuwakm-j=fFGoWPxDoBS+AjK4Wwforc-FA@mail.gmail.com> (raw)
In-Reply-To: <55479DC6.4090404@baturin.org>

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

My usual approach for such kind of tasks is to have an `Lwt_stream.t` of
messages, from all the connections.
Then I use `Lwt_stream.fold` to literally fold my state over all messages.

On Mon, May 4, 2015 at 12:26 PM, Daniil Baturin <daniil@baturin.org> wrote:

> Hi all,
>
> I'm trying to figure out how to handle concurrent connections with Lwt,
> and I'm quite confused.
>
> Suppose I'm writing an IRC server (actually I'm not, but connection
> handling model will be similar).
> I need to accept connections, read from descriptors, and update some state.
>
> So far I've only found examples of handling HTTP-style requests (reply
> and close).
>
> What is the proper way to do this in Lwt? Are there any projects or code
> examples I can learn from?
>
> Thanks,
> Daniil
>
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 1691 bytes --]

  reply	other threads:[~2015-05-04 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 12:35 [Caml-list] [TFP'15] call for participation Peter Achten
2015-05-04 16:26 ` [Caml-list] Handling concurrent connections with Lwt Daniil Baturin
2015-05-04 17:33   ` Ivan Gotovchits [this message]
2015-05-04 20:07     ` Daniil Baturin

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='CALdWJ+xqFZG4apsysuwakm-j=fFGoWPxDoBS+AjK4Wwforc-FA@mail.gmail.com' \
    --to=ivg@ieee.org \
    --cc=caml-list@inria.fr \
    --cc=daniil@baturin.org \
    /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