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 VAA32387; Mon, 28 Apr 2003 21:09:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA15270 for ; Mon, 28 Apr 2003 21:09:23 +0200 (MET DST) Received: from goliath.siemens.de (goliath.siemens.de [192.35.17.28]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h3SJ9MT00290 for ; Mon, 28 Apr 2003 21:09:23 +0200 (MET DST) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.11.7/8.11.7) with ESMTP id h3SJ9Lf28951 for ; Mon, 28 Apr 2003 21:09:21 +0200 (MEST) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail3.siemens.de (8.11.7/8.11.7) with ESMTP id h3SJ9Lj13355 for ; Mon, 28 Apr 2003 21:09:21 +0200 (MEST) Received: from basecamp.cert (neptun.cert.siemens.de [139.23.202.131]) by mars.cert.siemens.de (8.12.9/8.12.9/$SiemensCERT: mail/cert.mc,v 1.42 2003/02/21 12:06:56 ust Exp $) with ESMTP id h3SJ9LhG019773 for ; Mon, 28 Apr 2003 21:09:21 +0200 (CEST) Received: by neptun.cert.siemens.de with Internet Mail Service (5.5.2653.19) id ; Mon, 28 Apr 2003 21:09:21 +0200 Message-ID: <4F8477CFC03A71499AD8DDA428F5E114037D19@neptun.cert.siemens.de> From: Christian.Schaller@siemens.com To: caml-list@inria.fr Subject: [Caml-list] reading from socket connection Date: Mon, 28 Apr 2003 21:09:20 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam: no; 0.00; schaller:01 nntp:01 cygwin:01 sockaddr:01 endline:01 chris:01 ocaml:01 flush:01 eof:02 unix:02 string:03 addr:03 library:03 let:04 inet:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, When connecting, let's say to a nntp server and just exchanging some information, the OCaml manual tells me to use open_connection from the Unix library. This works well, however, how can I read the output from the remote server? My first try was a readLines function (see below) to read until EOF, however there's no EOF, thus my program hanging. Any hints? Is this a cygwin related problem? Thanks, Chris open Unix let server = inet_addr_of_string "10.10.10.10" let sockaddr = ADDR_INET (server, 119) let readLines ch = try while true do print_endline (input_line ch) done with End_of_file -> ();; let client_fun ic oc = output_string oc "help\n"; flush oc; readLines ic let _ = let ic, oc = open_connection sockaddr in client_fun ic oc; shutdown_connection ic ------------------- 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