caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <debian00@tiscali.be>
To: "O'Caml Mailing List" <caml-list@inria.fr>
Subject: [Caml-list] What's wrong with win32?
Date: Tue, 30 Mar 2004 12:49:42 +0200 (CEST)	[thread overview]
Message-ID: <20040330.124942.118545865.debian00@tiscali.be> (raw)

Hi everybody,

The following simple program works well undex Unix/Linux :
----------------------------------------------------------------------
open Printf

let header machine port file =
  let addr = (Unix.gethostbyname machine).Unix.h_addr_list.(0) in
  let (ic, oc) = Unix.open_connection (Unix.ADDR_INET(addr, port)) in
  fprintf oc "GET /%s HTTP/1.0\r\n\r\n" file;
  flush oc;
  let rec read_more() =
    let s = input_line ic in
    let s = String.sub s 0 (String.length s - 1) in
    if s = "" then () else (
      printf "%s> %s\n" machine s;
      read_more()
    ) in
  read_more();
  Unix.shutdown_connection ic

let () = header "www.umh.ac.be" 80 "index.html"
----------------------------------------------------------------------

However, when I try to run it under windows 98, (and despite the fact
that it compiles fine to byte-code) I really get into trouble.  First,
the line "flush oc" raises the exception (!!!)

  Fatal error: exception Sys_error("Bad file descriptor")

Also "input_line" seems to wait forever to receive data.  I am not
familiar with win32, so maybe I missed something obvious.

Any help will be greatly appreciated.
ChriS

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2004-03-30 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-30 10:49 Christophe TROESTLER [this message]
2004-03-30 17:09 ` Christophe TROESTLER
2004-04-01  8:43   ` Correnson Loïc
2004-04-01 13:32   ` Xavier Leroy
2004-04-03 12:30     ` Christophe TROESTLER

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=20040330.124942.118545865.debian00@tiscali.be \
    --to=debian00@tiscali.be \
    --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;
as well as URLs for NNTP newsgroup(s).