caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: "'Gerd Stolpmann'" <info@gerd-stolpmann.de>
Cc: "'OCaml List'" <caml-list@inria.fr>
Subject: RE: [Caml-list] Writing to a blocked socket
Date: Tue, 2 Aug 2011 20:41:40 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9C23D3ACA@Remus.metastack.local> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9C23D38EE@Remus.metastack.local>

I just translated that OCaml example to C and it works correctly under Windows which suggests it's a bug in OCaml... so I'll attach that ML file to a Mantis report, instead!

David Allsopp wrote:
> Gerd Stolpmann wrote:
> > Am Dienstag, den 02.08.2011, 18:01 +0100 schrieb David Allsopp:
> > > I don't seem to be able to ask Google this in a way which will give
> > > me a reasonable answer!
> > >
> > > In the same process, if you have one thread blocked on a [recv]
> > > operation on a socket, under Unix another thread can still write to
> > > the socket. Under Windows, however, the call to [send] blocks
> > > because there's another thread blocked on a [recv] to the same
> > > socket. Are there any options that can be set to change that
> > > behaviour or is that just "the way it is" and the application has to
> > > be coded using [select]
> > instead?
> >
> > Really? This does not make sense at all. It's quite normal that one
> > direction is blocked, and the other not. Are you sure about your
> > observation?
> 
> Seems to be, from the attached - important bit is on the last 10 lines -
> the function readThread is spawned in a thread of its own and then the
> loop below reads input and sends each line down the socket.
> 
> Compiled with:
> 
> ocamlfind ocamlopt -o foo -thread -package unix,threads -linkpkg Foo.ml
> 
> and then executed as:
> 
> ./foo www.google.com
> 
> I enter:
> 
> GET / HTTP/1.0
> 
> followed by two new lines... on Linux I get a response from Google, on
> Windows it hangs after the first line. 3.12.0 (and 3.10.1 on an old
> machine) all behaving the same way.
> 
> David
> 
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



      reply	other threads:[~2011-08-02 20:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 17:01 David Allsopp
2011-08-02 19:16 ` Gerd Stolpmann
2011-08-02 20:17   ` David Allsopp
2011-08-02 20:41     ` David Allsopp [this message]

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=E51C5B015DBD1348A1D85763337FB6D9C23D3ACA@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    /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;
as well as URLs for NNTP newsgroup(s).