caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] What's wrong with win32?
@ 2004-03-30 10:49 Christophe TROESTLER
  2004-03-30 17:09 ` Christophe TROESTLER
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe TROESTLER @ 2004-03-30 10:49 UTC (permalink / raw)
  To: O'Caml Mailing List

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-04 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-30 10:49 [Caml-list] What's wrong with win32? Christophe TROESTLER
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

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).