From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA22067; Tue, 30 Mar 2004 12:49:29 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA20492 for ; Tue, 30 Mar 2004 12:49:27 +0200 (MET DST) Received: from abel.swapping.umh.ac.be (nat2.umh.ac.be [193.190.193.2]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i2UAnQHd020791 for ; Tue, 30 Mar 2004 12:49:27 +0200 Received: from abel.swapping.umh.ac.be ([127.0.0.1] helo=localhost ident=trch) by abel.swapping.umh.ac.be with esmtp (Exim 3.36 #1 (Debian)) id 1B8GoR-0004C1-00; Tue, 30 Mar 2004 12:49:43 +0200 Date: Tue, 30 Mar 2004 12:49:42 +0200 (CEST) Message-Id: <20040330.124942.118545865.debian00@tiscali.be> To: "O'Caml Mailing List" Subject: [Caml-list] What's wrong with win32? From: Christophe TROESTLER Organization: None X-Spook: Verisign EuroFed CNCIS Ermes illuminati CBNRC quarter Ruby Ridge MILSATCOM mania X-Mailer-URL: http://www.mew.org/ X-Operating-System: GNU/Linux (http://www.linux.org/) X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Mailer: Mew version 4.0.61 on Emacs 21.3.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; troestler:01 tiscali:99 printf:01 fprintf:01 printf:01 compiles:01 descriptor:01 32,:01 chris:01 christophe:01 flush:01 flush:01 rec:01 raises:01 exception:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 414 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