Browse thread
[Caml-list] What's wrong with win32?
- Christophe TROESTLER
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christophe TROESTLER <debian00@t...> |
| Subject: | [Caml-list] What's wrong with win32? |
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